Skip to content

DOC: Clarify that 'names' is only used when constructing a MultiIndex #61619

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

Closed
wants to merge 1 commit into from

Conversation

EdwardPunzalan
Copy link

Description

Clarifies in the Index class docstring that the names parameter is only relevant when constructing a MultiIndex. This prevents confusion where users expect names=('a',) to behave like name='a' for regular Index objects.

No changes were made to the behavior of Index, only to the documentation for better clarity.

>>> pd.Index([], name='a').name
'a'

>>> pd.Index([], names=['a']).name is None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those seem like a test more than an example. And I don't see names as a parameter of Index: https://pandas.pydata.org/docs/dev/reference/indexing.html#index

I guess the issue is outdated, it's from 2018, and last comment confirms.

@datapythonista
Copy link
Member

I'll close this PR as it doesn't feel useful. Feel free to comment if I'm missing something, and I can surely reopen.

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.

BUG: Creating Index name using names names argument, doesn't set index name
2 participants