Skip to content

ENH: Better rename/set_names handling for Index #4718

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

Merged
merged 1 commit into from
Sep 1, 2013

Conversation

jtratner
Copy link
Contributor

Fixes #4628

  • MultiIndex now responds correctly to rename (synonym for
    set_names)
  • set_names checks that input is list like.
  • Cleaner error message for immutable ops.
  • Added in previously missing tests for MultiIndex immutable metadata.
  • Altered is_list_like to check for binary_types as well.

For now, this is the behavior for Index.rename. It's simple and clear and lets existing code just work instead of dealing with typechecks:

In [2]: ind = Index(range(10))

In [3]: ind = ind.rename((u'A', u'B'))

In [4]: ind.name
Out[4]: (u'A', u'B')

In [5]: ind.names
Out[5]: FrozenList([(u'A', u'B')])

* MultiIndex now responds correctly to ``rename`` (synonym for
  ``set_names``)
* ``set_names`` checks that input is list like.
* Cleaner error message for immutable ops.
* Added in previously missing tests for MultiIndex immutable metadata.
* Altered ``is_list_like`` to check for binary_types as well.
@jtratner
Copy link
Contributor Author

jtratner commented Sep 1, 2013

@jreback any comments?

@jreback
Copy link
Contributor

jreback commented Sep 1, 2013

looks good to me

jtratner added a commit that referenced this pull request Sep 1, 2013
ENH: Better rename/set_names handling for Index
@jtratner jtratner merged commit 3479c27 into pandas-dev:master Sep 1, 2013
@jtratner jtratner deleted the multiindex-rename branch September 1, 2013 01:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ENH: Support rename on MultiIndex
2 participants