wesm/pandas — Issue #272: Change Series.clip to work with numpy.clip
Author: wesm
Created: 2011-10-21 19:18:36+00:00
State: open
Labels: Enhancement

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.
```