From 3eac045c9861494273a01f6b2e8d9e10b60159ff Mon Sep 17 00:00:00 2001 From: Anatoly Myachev Date: Tue, 12 Sep 2023 21:22:19 +0200 Subject: [PATCH] FIX-#6553: fix 'read_csv' with 'iterator=True' Signed-off-by: Anatoly Myachev --- modin/core/io/text/text_file_dispatcher.py | 3 +++ modin/pandas/test/test_io.py | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/modin/core/io/text/text_file_dispatcher.py b/modin/core/io/text/text_file_dispatcher.py index 158212b37ec..75f05356bb1 100644 --- a/modin/core/io/text/text_file_dispatcher.py +++ b/modin/core/io/text/text_file_dispatcher.py @@ -683,6 +683,9 @@ def check_parameters_support( if read_kwargs["chunksize"] is not None: return (False, "`chunksize` parameter is not supported") + if read_kwargs.get("iterator"): + return (False, "`iterator==True` parameter is not supported") + if read_kwargs.get("dialect") is not None: return (False, "`dialect` parameter is not supported") diff --git a/modin/pandas/test/test_io.py b/modin/pandas/test/test_io.py index d28aca0294e..6e93954a358 100644 --- a/modin/pandas/test/test_io.py +++ b/modin/pandas/test/test_io.py @@ -614,6 +614,16 @@ def test_read_csv_iteration(self, iterator): df_equals(modin_df, pd_df) + # Tests #6553 + if iterator: + rdf_reader = pd.read_csv(filename, iterator=iterator) + pd_reader = pandas.read_csv(filename, iterator=iterator) + + modin_df = rdf_reader.read() + pd_df = pd_reader.read() + + df_equals(modin_df, pd_df) + def test_read_csv_encoding_976(self): file_name = "modin/pandas/test/data/issue_976.csv" names = [str(i) for i in range(11)]