Skip to content

ENH: Allow abs to work with PandasObjects #4821

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

Merged
merged 1 commit into from
Sep 11, 2013

Conversation

jtratner
Copy link
Contributor

Add __abs__ method so that you can use the toplevel abs() with
PandasObjects. I note there aren't that many existing test cases for
abs. At some point we might want to think about that.

Also related #4819

cc @Thisch

@jtratner
Copy link
Contributor Author

if no objections, will merge this soon. Entirety of the change is adding this:

def __abs__(self):
    return self.abs()

@jreback
Copy link
Contributor

jreback commented Sep 11, 2013

this is fine....just an oversight, I think < 0.13, abs(a_series) worked because numpy defined abs

@cpcloud
Copy link
Member

cpcloud commented Sep 11, 2013

Yep numpy does define abs. Looks good.

jtratner added a commit that referenced this pull request Sep 11, 2013
ENH: Allow abs to work with PandasObjects
@jtratner jtratner merged commit 165a94c into pandas-dev:master Sep 11, 2013
@jtratner
Copy link
Contributor Author

thanks for pointing this out @Thisch - now all pandas objects support abs and your original code should now work.

@jtratner
Copy link
Contributor Author

what the heck? I added release notes to this and pushed them to Github before merging, but they didn't end up in this PR. weird. Worth committing separately @jreback ?

@jreback
Copy link
Contributor

jreback commented Sep 11, 2013

ha....just was noticing that...no...you can throw them in next time you merge something

@cpcloud
Copy link
Member

cpcloud commented Sep 12, 2013

no test for poor-old Series 😢?

@jtratner
Copy link
Contributor Author

It gets tested in test_panel (weirdly). If we want to add abs tests, we should do it to test the abs method...this is basically just adding some sugar :)

@cpcloud
Copy link
Member

cpcloud commented Sep 12, 2013

ah ok yep i c now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants