Skip to content

Commit

Permalink
FIX-modin-project#5150: Sync row labels after read_csv when index_col…
Browse files Browse the repository at this point in the history
… is False

Signed-off-by: Igoshev, Iaroslav <iaroslav.igoshev@intel.com>
  • Loading branch information
YarShev committed Oct 23, 2022
1 parent 6cc441a commit 577c7f1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modin/core/io/text/text_file_dispatcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -939,7 +939,7 @@ def _get_new_qc(
new_query_compiler = new_query_compiler.take_2d(
pandas.RangeIndex(len(new_query_compiler.index))[:nrows]
)
if index_col is None:
if index_col is None or index_col is False:
new_query_compiler._modin_frame.synchronize_labels(axis=0)

return new_query_compiler
Expand Down
8 changes: 8 additions & 0 deletions modin/pandas/test/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -1334,6 +1334,14 @@ def test_to_csv_with_index(self):
).set_index("key")
eval_to_file(modin_df, pandas_df, "to_csv", "csv")

def test_read_csv_issue_5150(self):
pandas_df = pandas.DataFrame(np.random.randint(0, 100, size=(2**6, 2**6)))
pandas_df.to_csv("issue5150.csv", index=False)
expected_pandas_df = pandas.read_csv("issue5150.csv", index_col=False)
modin_df = pd.read_csv("issue5150.csv", index_col=False)
actual_pandas_df = modin_df._to_pandas()
df_equals(expected_pandas_df, actual_pandas_df)


class TestTable:
def test_read_table(self, make_csv_file):
Expand Down

0 comments on commit 577c7f1

Please sign in to comment.