Skip to content

Commit

Permalink
fix list RHS
Browse files Browse the repository at this point in the history
  • Loading branch information
noloerino committed Sep 12, 2024
1 parent 763e09a commit 90fb128
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modin/core/storage_formats/pandas/query_compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,9 @@ def _series_logical_binop(func):
Build a callable function to pass to Binary.register for Series logical operators.
"""
return lambda x, y, **kwargs: func(
x.squeeze(axis=1), y.squeeze(axis=1), **kwargs
x.squeeze(axis=1),
y.squeeze(axis=1) if isinstance(y, pandas.DataFrame) else y,
**kwargs,
).to_frame()


Expand Down
9 changes: 9 additions & 0 deletions modin/tests/pandas/test_series.py
Original file line number Diff line number Diff line change
Expand Up @@ -5130,3 +5130,12 @@ def test_binary_with_fill_value_issue_7381(op):
result_md = getattr(series_md, op)(rhs_md, fill_value=2)
result_pd = getattr(series_pd, op)(rhs_pd, fill_value=2)
df_equals(result_md, result_pd)


@pytest.mark.parametrize("op", ["eq", "ge", "gt", "le", "lt", "ne"])
def test_logical_binary_with_list(op):
series_md, series_pd = create_test_series([0, 1, 2])
rhs = [2, 1, 0]
result_md = getattr(series_md, op)(rhs)
result_pd = getattr(series_pd, op)(rhs)
df_equals(result_md, result_pd)

0 comments on commit 90fb128

Please sign in to comment.