Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/series.py
Original file line number Diff line number Diff line change
Expand Up @@ -6861,7 +6861,7 @@ def _flex_method(self, other, op, *, level=None, fill_value=None, axis: Axis = 0

if isinstance(other, Series):
return self._binop(other, op, level=level, fill_value=fill_value)
elif isinstance(other, (np.ndarray, list, tuple, ExtensionArray)):
elif isinstance(other, (list, tuple)) or (isinstance(other, np.ndarray) and other.ndim > 0):
if len(other) != len(self):
raise ValueError("Lengths must be equal")
other = self._constructor(other, self.index, copy=False)
Expand Down
8 changes: 8 additions & 0 deletions pandas/tests/series/methods/test_clip.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,3 +155,11 @@ def test_clip_with_timestamps_and_oob_datetimes_non_nano(self):
expected = Series([lower, upper], dtype=dtype)

tm.assert_series_equal(result, expected)

def test_clip_with_scalar_array_lower(self):
# GH#59053
ser = Series([-1, 2, 3])
lower = np.array(0)
result = ser.clip(lower=lower)
expected = Series([0, 2, 3])
tm.assert_series_equal(result, expected)
Loading