-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Chainable Series.set_name() #9494
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
Comments
this is kind of like #9239 functionaility wise what about having |
What else would go in And of course, we need to be careful about not modifying the original |
I think we could move |
ok, @wavexx want to do a pull-request to add |
On 02/16/2015 03:03 PM, jreback wrote:
What about modifying self? |
I think this needs to copy by default. Though on a series this is quite cheap (as its a view). |
Another option is to repurpose This does overload |
Thanks a lot for this.
|
Not a problem. We should have a 0.18 release candidate out soon, if you're willing / able to try it out and report back any bugs! |
closes pandas-dev#9494 closes pandas-dev#11965 Okay refactored to overload `NDFrame.rename` and `NDFrame.rename_axis` New rules: - Series.rename(scalar) or Series.rename(list-like) will alter `Series.name` - NDFrame.rename(mapping) and NDFrame.rename(function) operate as before (alter labels) - NDFrame.rename_axis(scaler) or NDFrame.rename_axis(list-like) will change the Index.name or MutliIndex.names - NDFrame.rename_axis(mapping) and NDFrame.rename_axis(function) operate as before. I don't like overloading the method like this, but `rename` and `rename_axis` are the right method names. It's *mostly* backwards compatible, aside from people doing things like `try: series.rename(x): except TypeError: ...` and I don't know what our guarantees are around things like that. Author: Tom Augspurger <[email protected]> Closes pandas-dev#11980 from TomAugspurger/chainable-rename and squashes the following commits: b36df76 [Tom Augspurger] ENH/API: Series.rename and NDFrame.rename_axis
It's sometimes convenient to assign/replace the name of a Series, especially if the result is going to be a DataFrame column, for example:
This should be as simple as:
Comments?
The text was updated successfully, but these errors were encountered: