Skip to content

Conversation

@cmp0xff
Copy link
Contributor

@cmp0xff cmp0xff commented Nov 21, 2025

Note str is also Iterable[HashableT] but DataFrame.loc[..., str] produces Series instead of DataFrame, so I need to shuffle the order of the overloads.

Copy link
Member

@MarcoGorelli MarcoGorelli left a comment

Choose a reason for hiding this comment

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

thanks @cmp0xff - so the main difference is

- list[HashableT]
+ Iterable[HashableT]

in the tuple case right? the rest is just moving the overloads around?

@cmp0xff
Copy link
Contributor Author

cmp0xff commented Nov 24, 2025

Hi @MarcoGorelli , yes that's what I did.

After working out this, I feel that when list is allowed but tuple is not, we may try MutableSequence to replace list. lists are not covariant, which can be annoying.

@cmp0xff cmp0xff merged commit 5a47589 into pandas-dev:main Nov 24, 2025
16 checks passed
@cmp0xff cmp0xff deleted the bugfix/1410-df-loc branch November 24, 2025 17:07
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.

DataFrame.loc does not like Sequence[Hashable] for the columns

3 participants