-
-
Notifications
You must be signed in to change notification settings - Fork 141
Problem accessing .loc
with tuple for MultiIndex Series
#899
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
Comments
Thanks for the report. I think that if we add pandas-stubs/pandas-stubs/core/series.pyi Lines 194 to 201 in 0342d90
that will fix this. PR with tests welcome. |
I updated a test case for the issue in the PR. I tested the above suggested solution which fails with It gives
instead of
I also tried adding an additional overload option:
This one worked with mypy (no error raised) but it failed for pyright
|
Instead of use |
Describe the bug
When accessing with tuples a MultiIndex Serie, I get an
Invalid index type error
The example code is from the offical pandas user guides:
https://pandas.pydata.org/docs/user_guide/advanced.html#advanced-indexing-with-hierarchical-index
It seems the type is simply not in the expected types, but it should by, as this is an offical way of accessing multi-index timeseries.
To Reproduce
Minimal runnable
pandas
example that is not properly checked by the stubs:using
mypy
receiving:
pandas-stubs
2.2.1.240316The text was updated successfully, but these errors were encountered: