-
-
Notifications
You must be signed in to change notification settings - Fork 141
allow multiindex for a column in DataFrame.loc #494
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
Conversation
pandas-stubs/core/frame.pyi
Outdated
@@ -166,7 +166,9 @@ class _LocIndexerFrame(_LocIndexer): | |||
@overload | |||
def __getitem__( | |||
self, | |||
idx: tuple[int | StrLike | tuple[ScalarT, ...], int | StrLike], | |||
idx: tuple[ | |||
int | StrLike | tuple[ScalarT, ...], int | StrLike | tuple[ScalarT, ...] |
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.
Would Scalar
also work here instead of ScalarT
?
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.
Would
Scalar
also work here instead ofScalarT
?
Yes, seems so. Fixed in commit 3417725
pandas-stubs/core/indexing.pyi
Outdated
@@ -15,7 +15,7 @@ from pandas._typing import ( | |||
) | |||
|
|||
_IndexSliceTuple: TypeAlias = tuple[ | |||
Union[Index, MaskType, Scalar, list[ScalarT], slice], ... | |||
Union[Index, MaskType, Scalar, list[ScalarT], slice | tuple[ScalarT, ...]], ... |
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.
Same here (I think we need it for list
but not sure about tuple
).
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.
Same here (I think we need it for
list
but not sure abouttuple
).
Yes, fixed in commit 3417725
pandas-stubs/core/series.pyi
Outdated
index: Axes | None = ..., | ||
dtype=..., | ||
name: Hashable | None = ..., | ||
copy: bool = ..., | ||
fastpath: bool = ..., | ||
) -> Series[IntervalT]: ... | ||
) -> Series[Interval[int]]: ... | ||
@overload |
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.
would be nice to add the TODO again
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.
Same issue - included the changes from the other PR, so I've reverted that here in commit fb51203
Thanks @Dr-Irv ! |
* split Series[IntervalT] into separate __new__ * allow multiindex for a colun in DataFrame.loc * revert changes related to Series.__new__ and IntervalT * change tuple[ScalarT,...] to tuple[Scalar, ...]
pandas.DataFrame.loc
with atuple[str, str]
multi-index seems to elicitmypy
errors #466test_frame.py:test_getsetitem_multiindex()