-
- Notifications
You must be signed in to change notification settings - Fork 19.3k
BUG: Fix Index.get_level_values() mishandling of boolean, pd.NA, np.nan, and pd.NaT levels #62175
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
base: main
Are you sure you want to change the base?
Changes from 5 commits
3df788a fe07d18 f57ddc5 eca19a2 390f3ef 629bdf9 041994c d881247 3e63865 7f541de 703085e 3793317 d32d836 c03d480 19832f3 File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| | @@ -2084,7 +2084,10 @@ def _validate_index_level(self, level) -> None: | |||||||||||
| verification must be done like in MultiIndex. | ||||||||||||
| | ||||||||||||
| """ | ||||||||||||
| if isinstance(level, int): | ||||||||||||
| if type(level) is int: | ||||||||||||
| ||||||||||||
| if type(level) is int: | |
| if type(level) is int: | |
| if isinstance(self.name, int) and level == self.name: | |
| return |
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.
lib.is_integer
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.
I think that this is a better verification that validates what is expected from the documentation.
| elif isinstance(level, str) and isinstance(self.name, str) and level != self.name: | |
| raise KeyError( | |
| f"Requested level ({level}) does not match index name ({self.name})" | |
| ) |
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.
seems this change is unrelated to the rest of the PR?
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.
Yes, actually, I was trying something and forgot to undo this change. It's fixed in the latest commit.