-
-
Notifications
You must be signed in to change notification settings - Fork 141
Add Tuple[slice] in iLocIndexerFrame. Fix #143 #152
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
Is that an actual supported mode for iloc? Or just an accident that works because tuples are unpacked in https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.iloc.html |
I don't know, I'm out of deep in this topic. I just following @Dr-Irv suggestion. |
The example in the issue is |
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.
Can you also add a test in test_frame.py
that fails without this change, and works with it? Copying the code from the original issue will suffice. Make sure to include a comment that refers to the issue.
I agree it works. I am just querying if pandas-stubs should be adding types that aren't part of the docstring. Shouldn't there be a change upstream to confirm that this is a supported format? |
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.
CI failing due to black
. Do poe style
to make sure everything is OK.
idx: IndexType | ||
| MaskType | ||
| tuple[IndexType | MaskType, IndexType | MaskType] | ||
| tuple[slice], |
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.
Sorry - I should have picked up on this before. Use
tuple[IndexType | MaskType, IndexType | MaskType | slice]
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.
That change fails the test I made
Type "tuple[slice]" cannot be assigned to type "IndexType | MaskType | tuple[IndexType | MaskType, IndexType | MaskType]"
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.
My mistake. I missed the comma
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.
Thanks @AchmadFathoni
assert_type()
to assert the type of any return value