diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py index 9280e2233f6..0d8bcd0d314 100644 --- a/modin/pandas/dataframe.py +++ b/modin/pandas/dataframe.py @@ -2711,7 +2711,6 @@ def __setitem__(self, key, value) -> None: to_concat.append(src_obj[to_take]) new_qc = concat(to_concat, axis=1)._query_compiler - new_qc.index = self.index else: new_qc = self._query_compiler.write_items( slice(None), diff --git a/modin/tests/pandas/dataframe/test_indexing.py b/modin/tests/pandas/dataframe/test_indexing.py index 35592d93e12..ebf041625ac 100644 --- a/modin/tests/pandas/dataframe/test_indexing.py +++ b/modin/tests/pandas/dataframe/test_indexing.py @@ -2177,8 +2177,10 @@ def test___setitem__(data): df_equals(modin_df, pandas_df) # Test df assignment to a columns selection - modin_df[modin_df.columns[[0, -1]]] = modin_df[modin_df.columns[[0, -1]]] - pandas_df[pandas_df.columns[[0, -1]]] = pandas_df[pandas_df.columns[[0, -1]]] + modin_columns = modin_df.columns[[0, -1]] + pandas_columns = pandas_df.columns[[0, -1]] + modin_df[modin_columns] = modin_df[modin_columns] + pandas_df[pandas_columns] = pandas_df[pandas_columns] df_equals(modin_df, pandas_df) # Test series assignment to column