Skip to content

Commit 22865a2

Browse files
authored
Update test_clip.py
1 parent dcb67f7 commit 22865a2

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

pandas/tests/series/methods/test_clip.py

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pytest
55

66
from pandas.errors import OutOfBoundsDatetime
7-
87
import pandas as pd
98
from pandas import (
109
Series,
@@ -155,3 +154,18 @@ def test_clip_with_timestamps_and_oob_datetimes_non_nano(self):
155154
expected = Series([lower, upper], dtype=dtype)
156155

157156
tm.assert_series_equal(result, expected)
157+
158+
def test_clip_with_scalar_numpy_array_lower():
159+
s = pd.Series([-1, 2, 3])
160+
result = s.clip(lower=np.array(0))
161+
expected = pd.Series([0, 2, 3])
162+
tm.assert_series_equal(result, expected)
163+
164+
def test_clip_with_scalar_numpy_array_upper():
165+
s = pd.Series([-1, 2, 3])
166+
result = s.clip(upper=np.array(2))
167+
expected = pd.Series([-1, 2, 2])
168+
tm.assert_series_equal(result, expected)
169+
170+
171+

0 commit comments

Comments
 (0)