Skip to content

Commit

Permalink
FIX-modin-project#2442: axis alignment fixed in case of 'setitem'
Browse files Browse the repository at this point in the history
Signed-off-by: Dmitry Chigarev <[email protected]>
  • Loading branch information
dchigarev committed Dec 9, 2020
1 parent db173b2 commit ff5ec3b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modin/backends/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2214,10 +2214,10 @@ def setitem(self, axis, key, value):
Returns:
A new QueryCompiler
"""
if isinstance(value, type(self)) and not value.get_axis(axis).equals(
if isinstance(value, type(self)) and not value.get_axis(0).equals(
self.get_axis(axis)
):
value = value.reindex(axis, self.get_axis(axis))
value = value.reindex(0, self.get_axis(axis))

return self._setitem(axis=axis, key=key, value=value)

Expand Down
4 changes: 2 additions & 2 deletions modin/pandas/test/dataframe/test_indexing.py
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ def test_loc_multi_index():
df_equals(modin_df.loc[modin_df.index[:7]], pandas_df.loc[pandas_df.index[:7]])


@pytest.mark.parametrize("index", [["row1", "row2", "row3"], ["row1"]])
@pytest.mark.parametrize("columns", [["col1", "col2"], ["col1"]])
@pytest.mark.parametrize("index", [["row1", "row2", "row3"]])
@pytest.mark.parametrize("columns", [["col1", "col2"]])
def test_loc_assignment(index, columns):
md_df, pd_df = create_test_dfs(index=index, columns=columns)
for i, ind in enumerate(index):
Expand Down

0 comments on commit ff5ec3b

Please sign in to comment.