Skip to content

ENH: add rmod methods to frame and series #4035

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 2 commits into from
Jun 26, 2013
Merged

ENH: add rmod methods to frame and series #4035

merged 2 commits into from
Jun 26, 2013

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented Jun 26, 2013

No description provided.

@jreback
Copy link
Contributor

jreback commented Jun 26, 2013

your sure this is necessary

#3590 fixed these mod issues

@cpcloud
Copy link
Member Author

cpcloud commented Jun 26, 2013

as it stands mod follows series % df == df % series which is wrong IMO

@cpcloud
Copy link
Member Author

cpcloud commented Jun 26, 2013

this pr fixes that

@jreback
Copy link
Contributor

jreback commented Jun 26, 2013

so the broadcasting is wrong?

@@ -874,7 +876,8 @@ def __contains__(self, key):
default_axis=None, fill_zeros=np.inf)
__rpow__ = _arith_method(lambda x, y: y ** x, '__rpow__',
default_axis=None)
__rmod__ = _arith_method(operator.mod, '__rmod__', default_axis=None, fill_zeros=np.nan)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jreback this line here was calling mod(x, y) when it should be mod(y, x) that's why it was appearing commutative. rmod == mod here when it shouldn't

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

incidentally this was caught by my eval test suite

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh ok that's fine then
as long as exiting and new tests pass

@ghost ghost assigned cpcloud Jun 26, 2013
@cpcloud
Copy link
Member Author

cpcloud commented Jun 26, 2013

passes....i'll wait a bit to merge to make sure i didn't forget anything

@jreback
Copy link
Contributor

jreback commented Jun 26, 2013

I tried your fix, didn't realize this was an issue...its essentially not broadcasting..so good to go

cpcloud added a commit that referenced this pull request Jun 26, 2013
ENH: add rmod methods to frame and series
@cpcloud cpcloud merged commit 2f64c18 into pandas-dev:master Jun 26, 2013
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.

2 participants