-
-
Notifications
You must be signed in to change notification settings - Fork 18.9k
Closed
Labels
Milestone
Description
from @bburan
I always find Series.clip() a bit confusing because the order of
arguments are reversed compared with Numpy's clip() method:
Series.clip(self, upper=None, lower=None)
numpy.clip(a, a_min, a_max, out=None)
Also, the following doesn't work well:
x = Series(data=np.random.uniform(size=10))
np.clip(x, 0.4, 0.6)
I think numpy.clip is checking for the existence of the clip() method
on the Series and attempting to pass the arguments to Series.clip().
Since Series.clip() doesn't support the axis argument this approach
fails. Ideally, I'd prefer to be able to use clip() without having to
check whether the data is a numpy.ndarray or pandas.Series object.