Skip to content

Commit

Permalink
use np.asarray for threshold
Browse files Browse the repository at this point in the history
  • Loading branch information
yl2526 committed Jun 2, 2017
1 parent 8568044 commit 484b67f
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -4417,15 +4417,9 @@ def _clip_with_one_bound(self, threshold, method, axis, inplace):

# For arry_like threshold, convet it to Series with corret index
# `where` takes scalar, NDFrame, or callable for argument "other"
try:
if isinstance(subset, ABCSeries):
threshold = pd.Series(threshold, index=subset.index)
elif axis == 0:
threshold = pd.Series(threshold, index=subset.index)
else:
threshold = pd.Series(threshold, index=subset.columns)
finally:
return self.where(subset, threshold, axis=axis, inplace=inplace)
if (not isinstance(threshold, ABCSeries)) and is_list_like(threshold):
threshold = np.asarray(threshold)
return self.where(subset, threshold, axis=axis, inplace=inplace)

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

0 comments on commit 484b67f

Please sign in to comment.