-
-
Notifications
You must be signed in to change notification settings - Fork 19.4k
BUG: .rename* not treating Series as mapping #12626
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
|
I might remove or rename |
|
@TomAugspurger btw, make sure you are rebased on current master. |
pandas/core/series.py
Outdated
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 think lib.isscalar(...) or com.is_list_like(...) is more clear
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.
com.is_list_like(dict) is True, and I need to treat dicts differently than lists.
But if we're going to be raising on Series.rename(list) anway, I won't have to worry about lists at all...
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.
maybe tests both dict and Series (for the renamer), and anything else that could be there (e.g. callable)? you prob already have these tests......
d = {1: 10, 2: 20}
for value in [ d, Series(d) ]:
....
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.
These should all covered by test_generic now. Initially I didn't understand how test_generic was setup, so I added the test here. I think these tests are all redundant, and could remove them this one and test_rename above, but I always worry about deleting tests :)
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.
cool np. yeah. hard to stop the propogation of tests :)
Closes pandas-dev#12623 I added com.is_dict_like in pandas-dev#11980 and failed to use it for the `rename` method. Using that now and did some refactoring while I was in there. Added more tests for rename.
51a36af to
10ea582
Compare
|
Ok, the tests for the different possible arguments are here. I simplified the stuff with |
|
thanks @TomAugspurger |
Closes #12623
I added com.is_dict_like in #11980
and failed to use it for the
renamemethod. Using that now and didsome refactoring while I was in there. Added more tests for rename.