-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Deprecate mapper argument in rename #44672
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
Varun270
commented
Nov 29, 2021
- supposed fix DEPR Deprecate mapper argument in rename? #44627
- tests added / passed
- Ensure all linting tests pass, see here for how to run them
- whatsnew entry
pandas/core/series.py
Outdated
mapper = index | ||
if callable(mapper) or is_dict_like(mapper): |
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.
can also revert these lines (and the 2 above, and the call involving mapper
below)
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.
Yeah, I am familiar with the fact that I haven't reverted all the changes of series.rename
just wanted to run it by you so that you can confirm whether I am on the right track?
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.
will force push the rest of the changes if you give me a go-ahead.
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.
yes, go ahead
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.
Pushed the rest of the changes, review them whenever you are free!!
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 function test_rename_no_method_no_index
no longer exists. So should I remove the function test_rename_method_and_index
?
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.
Yes you can remove test_rename_method_and_index
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 Entire function?
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.
yup, if we're removing mapper
it's no longer relevant
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.
On it.
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.
CI checks are failing, can you address them please?
pandas/core/generic.py:4421: error: unused "type: ignore" comment
pandas/core/generic.py:4485: error: unused "type: ignore" comment
This reverts commit f69e0c3.
Sorry, I don't know how to address failing checks, I don't know anything about CI/CD. |
you can just remove those two I'd suggest you read through the contributing guide in full too https://pandas.pydata.org/docs/development/contributing.html |
Yeah sure, Thanks for your effort. |
This reverts commit f69e0c3.
You can review it again I have done the changes that you suggested. |
pandas/core/generic.py
Outdated
@@ -4418,7 +4418,7 @@ def add_prefix(self: NDFrameT, prefix: str) -> NDFrameT: | |||
# expected "NDFrameT") | |||
# error: Argument 1 to "rename" of "NDFrame" has incompatible type | |||
# "**Dict[str, partial[str]]"; expected "Union[str, int, None]" | |||
return self.rename(**mapper) # type: ignore[return-value, arg-type] | |||
return self.rename(**mapper) |
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, this needs to be self._rename
(and then you'll likely need to put the type: ignore
back - sorry, I hadn't spotted this earlier)
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.
Yeah no problem will do it
pandas/core/generic.py
Outdated
@@ -4482,7 +4482,7 @@ def add_suffix(self: NDFrameT, suffix: str) -> NDFrameT: | |||
# expected "NDFrameT") | |||
# error: Argument 1 to "rename" of "NDFrame" has incompatible type | |||
# "**Dict[str, partial[str]]"; expected "Union[str, int, None]" | |||
return self.rename(**mapper) # type: ignore[return-value, arg-type] | |||
return self.rename(**mapper) |
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.
likewise (self._rename
)
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 have pushed the changes, You can review them whenever you are free.
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'll fail CI, can you run the black
formatter on the files you modified?
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 haven't installed black
also I don't know much about it.
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 have installed it and trying to figure out how it works. Is this document good to refer to https://www.freecodecamp.org/news/auto-format-your-python-code-with-black/
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.
Thanks @Varun270
Thanks for helping me, I learned a lot!! |
thanks @Varun270 |