Skip to content

Conversation

loicdiridollou
Copy link
Member

Comment on lines 310 to 316
def name(self) -> _str | None: ...
@name.setter
def name(self, value) -> None: ...
@property
def names(self) -> list[Hashable]: ...
def names(self) -> list[_str | None]: ...
@names.setter
def names(self, names: Sequence[Hashable]) -> None: ...
def names(self, names: SequenceNotStr[_str | None]) -> None: ...
Copy link
Collaborator

Choose a reason for hiding this comment

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

All of these should use Hashable instead of _str

e.g., the following is valid:

df.index.names=[3]

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes I realized this morning, all fixed with new test case.

Copy link
Collaborator

@Dr-Irv Dr-Irv left a comment

Choose a reason for hiding this comment

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

@Dr-Irv Dr-Irv merged commit 6155d44 into pandas-dev:main Aug 7, 2025
13 checks passed
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.

type annotation for Index/MultiIndex.names is incorrect

2 participants