Skip to content

Commit

Permalink
rename argument
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoGorelli committed Sep 30, 2024
1 parent fd69d7b commit 6906cbf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 3 additions & 1 deletion narwhals/_pandas_like/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -619,7 +619,9 @@ def quantile(

def zip_with(self: Self, mask: Any, other: Any) -> PandasLikeSeries:
ser = self._native_series
mask = validate_column_comparand(ser.index, mask, broadcast_length_one=False)
mask = validate_column_comparand(
ser.index, mask, treat_length_one_as_scalar=False
)
other = validate_column_comparand(ser.index, other)
res = ser.where(mask, other)
return self._from_native_series(res)
Expand Down
4 changes: 2 additions & 2 deletions narwhals/_pandas_like/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@


def validate_column_comparand(
index: Any, other: Any, *, broadcast_length_one: bool = True
index: Any, other: Any, *, treat_length_one_as_scalar: bool = True
) -> Any:
"""Validate RHS of binary operation.
Expand All @@ -52,7 +52,7 @@ def validate_column_comparand(
if isinstance(other, PandasLikeDataFrame):
return NotImplemented
if isinstance(other, PandasLikeSeries):
if other.len() == 1 and broadcast_length_one:
if other.len() == 1 and treat_length_one_as_scalar:
# broadcast
return other.item()
if other._native_series.index is not index:
Expand Down

0 comments on commit 6906cbf

Please sign in to comment.