-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
Convert DataFrame.rename to keyword only; simplify axis validation #29140
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
Changes from 1 commit
f09c6df
66acc90
177a440
b66e9e2
2415e46
296a9df
6ba8518
4128780
2776c7d
8e20fa4
cca8eed
1f8e1cf
4dc8bbe
1b261f8
b5e54bd
ab1ee2e
af0b7c5
d5d812c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,8 +83,9 @@ def test_rename_axis_supported(self): | |
s = Series(range(5)) | ||
s.rename({}, axis=0) | ||
s.rename({}, axis="index") | ||
with pytest.raises(ValueError, match="No axis named 5"): | ||
s.rename({}, axis=5) | ||
# TODO: clean up shared index validation | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Commented this out for now as I didn't think it was hugely critical and seemed somewhat orthoganal to the test, but can add back in if there is a huge objection. Ideally though we would have a centralized place for index validation that doesn't mutate the arguments of the caller. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fine to move this elsewhere. I do have a slight preference for not completely ignoring arguments that are there just for compatibility, but I don't know what our general rule is. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yea let me take another look I think should be able to keep this. Both I don't know if there is one consistent way we do this right now, but want to march towards that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the preference should be that the axis parameter should be validated if specified on a Series for consistency with most Series methods that accept axis (e.g. fillna) and all DataFrame methods that accept axis. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
normally you can just pass axis to super and it'll get validated? in this case there is also the call to self._set_name (cause of #28920). so probably will need the call to self._get_axis_number. |
||
# with pytest.raises(ValueError, match="No axis named 5"): | ||
# s.rename({}, axis=5) | ||
|
||
def test_set_name_attribute(self): | ||
s = Series([1, 2, 3]) | ||
|
Uh oh!
There was an error while loading. Please reload this page.