Skip to content

Commit ad0eb14

Browse files
authored
REGR: clip raising for list-bound (#54823)
1 parent 3e1a9d0 commit ad0eb14

File tree

2 files changed

+12
-0
lines changed

2 files changed

+12
-0
lines changed

pandas/core/frame.py

+1
Original file line numberDiff line numberDiff line change
@@ -7948,6 +7948,7 @@ def to_series(right):
79487948
)
79497949
elif isinstance(right, Series):
79507950
# axis=1 is default for DataFrame-with-Series op
7951+
axis = axis if axis is not None else 1
79517952
if not flex:
79527953
if not left.axes[axis].equals(right.index):
79537954
raise ValueError(

pandas/tests/frame/methods/test_clip.py

+11
Original file line numberDiff line numberDiff line change
@@ -177,3 +177,14 @@ def test_clip_int_data_with_float_bound(self):
177177
result = df.clip(lower=1.5)
178178
expected = DataFrame({"a": [1.5, 2.0, 3.0]})
179179
tm.assert_frame_equal(result, expected)
180+
181+
def test_clip_with_list_bound(self):
182+
# GH#54817
183+
df = DataFrame([1, 5])
184+
expected = DataFrame([3, 5])
185+
result = df.clip([3])
186+
tm.assert_frame_equal(result, expected)
187+
188+
expected = DataFrame([1, 3])
189+
result = df.clip(upper=[3])
190+
tm.assert_frame_equal(result, expected)

0 commit comments

Comments
 (0)