You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ideally, replace list[HashableT] with Sequece[HashableT]. But this doesn't work because str satsifies Sequence protocol. So at the least one could consider adding tuple manually.
Since this issue seems to be common, one might consider creating a custom container TypeAlias that in the future could be replaced with Sequence[H] & ~H if we ever get intersection and not types.
add slice to the first component.
Suggestion
tuple[
# in the index `Iterable[H]` works fine!slice|Hashable|Iterable[HashableT] |IndexType|MaskType,
# For the columns use `list[HashableT] | tuple[HashableT, ...]` instead of `Iterable[H]` to avoid matching `str`.slice|list[HashableT] |tuple[HashableT, ...] |Series[bool] |Callable,
]
Actually, if one restricts to loc[slice, list] it works, issue is with Multiindex columns allowing tuple to index a single column, which intersects with selecting multiple columns by an iterable of hashables. Closing.
Describe the bug
The current type hint contains:
The following modification should be considered
list[HashableT]
withSequece[HashableT]
. But this doesn't work becausestr
satsifiesSequence
protocol. So at the least one could consider addingtuple
manually.Sequence[H] & ~H
if we ever get intersection and not types.slice
to the first component.Suggestion
To Reproduce
Please complete the following information:
The text was updated successfully, but these errors were encountered: