-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Matched Round Signature with NumPy's #12603
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
Conversation
b008963
to
b3f4634
Compare
@gfyoung when we deal with this issue. can you do a search on current numpy as see what functions |
Yep, sounds good to me as a follow-up PR. |
b3f4634
to
24bf53b
Compare
@@ -4486,6 +4487,8 @@ def _series_round(s, decimals): | |||
return s.round(decimals) | |||
return s | |||
|
|||
validate_args(args, min_length=0, max_length=1) | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yep
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added.
ad735d7
to
0280828
Compare
0280828
to
9242804
Compare
@jreback: Any updates on this PR? I've been running tests and diff-ing locally to make sure that Travis should be happy once I remove the |
@@ -4420,7 +4421,7 @@ def merge(self, right, how='inner', on=None, left_on=None, right_on=None, | |||
right_index=right_index, sort=sort, suffixes=suffixes, | |||
copy=copy, indicator=indicator) | |||
|
|||
def round(self, decimals=0, out=None): | |||
def round(self, decimals=0, *args): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are these passed by position or kw?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately, numpy
passes them in as positional in fromnumeric.py
, so if we want to hide out
, it needs to reside in an *args
parameter and NOT a **kwargs
one.
i c you have removed dependene on #12413 great |
8d6f8d0
to
6f88946
Compare
Added the validator for |
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont' touch my whitespace!! this is on purpose
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My bad. Fixed.
7304b46
to
aad613b
Compare
length=length, | ||
max_length=max_length))) | ||
|
||
# See gh-12600; this is to allow compatibility with NumPy, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is wrong. it should only be triggered if you <= max_length and >= min_length args, then it should check if any are not None.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- I think it's already being triggered when that's the case. Otherwise, some sort of
ValueError
is thrown. - Are you saying that the check should be if all values in the tuple
*args
areNone
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the ideas is that when we use this validator function it will allow extra args (according to min/max lens), but they all must be None
, just a bit more general.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see. Done.
aad613b
to
ff9fc90
Compare
ok, looks good. ping when green (on your travis run is fine). |
@jreback : Travis has finally given the green light. Ready to merge if there's nothing else to change. |
ok, looks good. will merge in a bit. |
thanks @gfyoung for the patience! |
@jreback : No worries. Better to get it right the first time. 😄 |
Closes #12600 by re-accepting the
out
parameter as a**kwargs
argument. Also removes theout
parameter from the signature forDataFrame.round
and replaces it with**kwargs
like itsSeries
counterpart. Furthermore, sinceout
is a parameter that is not supported inpandas
, checks thatout
isNone
and throws an error if it isn't.