New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change Series.clip to work with numpy.clip #272

wesm opened this Issue Oct 21, 2011 · 1 comment


None yet
1 participant

wesm commented Oct 21, 2011

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.

This comment has been minimized.


wesm commented Oct 22, 2011

fixed in the above commit. thanks for the bug report

@wesm wesm closed this Oct 22, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment