Skip to content
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

ENH: Allow abs to work with PandasObjects #4821

Merged
merged 1 commit into from Sep 11, 2013

Conversation

@jtratner
Copy link
Contributor

commented Sep 11, 2013

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

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2013

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

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

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2013

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

@cpcloud

This comment has been minimized.

Copy link
Member

commented Sep 11, 2013

Yep numpy does define abs. Looks good.

jtratner added a commit that referenced this pull request Sep 11, 2013
Merge pull request #4821 from jtratner/add-__abs__-method
ENH: Allow abs to work with PandasObjects

@jtratner jtratner merged commit 165a94c into pandas-dev:master Sep 11, 2013

@jtratner

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2013

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

@jtratner

This comment has been minimized.

Copy link
Contributor Author

commented Sep 11, 2013

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

This comment has been minimized.

Copy link
Contributor

commented Sep 11, 2013

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

@cpcloud

This comment has been minimized.

Copy link
Member

commented Sep 12, 2013

no test for poor-old Series 😢?

@jtratner

This comment has been minimized.

Copy link
Contributor Author

commented Sep 12, 2013

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

This comment has been minimized.

Copy link
Member

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
Projects
None yet
3 participants
You can’t perform that action at this time.