Skip to content

Commit 484b67f

Browse files
committed
use np.asarray for threshold
1 parent 8568044 commit 484b67f

File tree

1 file changed

+3
-9
lines changed

1 file changed

+3
-9
lines changed

pandas/core/generic.py

+3-9
Original file line numberDiff line numberDiff line change
@@ -4417,15 +4417,9 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace):
44174417

44184418
# For arry_like threshold, convet it to Series with corret index
44194419
# `where` takes scalar, NDFrame, or callable for argument "other"
4420-
try:
4421-
if isinstance(subset, ABCSeries):
4422-
threshold = pd.Series(threshold, index=subset.index)
4423-
elif axis == 0:
4424-
threshold = pd.Series(threshold, index=subset.index)
4425-
else:
4426-
threshold = pd.Series(threshold, index=subset.columns)
4427-
finally:
4428-
return self.where(subset, threshold, axis=axis, inplace=inplace)
4420+
if (not isinstance(threshold, ABCSeries)) and is_list_like(threshold):
4421+
threshold = np.asarray(threshold)
4422+
return self.where(subset, threshold, axis=axis, inplace=inplace)
44294423

44304424
def clip(self, lower=None, upper=None, axis=None, inplace=False,
44314425
*args, **kwargs):

0 commit comments

Comments
 (0)