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
Describe the bug
The type hint for pandas.core.groupby.generic.DataFrameGroupBy.resample says it returns a pandas.core.groupby.grouper.Grouper; however in at least some situations this function can return a pandas.core.resample.DatetimeIndexResamplerGroupby, which is not a Grouper.
To Reproduce
This results in a false positive on MyPy 1.7.1:
Thanks for the report. Looking at the docs, we should change
to return a union of pandas.api.typing.DatetimeIndexResamplerGroupby, pandas.api.typing.PeriodIndexResamplerGroupby, and pandas.api.typing.TimedeltaIndexResamplerGroupby
Unfortunately, we haven't added the types for pandas.api.typing yet, nor do we have DatetimeIndexResamplerGroupby in core/resample.pyi . So that latter type should get added there, and can be the return type of resample(), since the other 2 types are subclasses of the first one.
Some care will need to be exercised, because in the stubs we are doing some things with respect to generic types that will have to be appropriately passed down for things to work.
Describe the bug
The type hint for
pandas.core.groupby.generic.DataFrameGroupBy.resample
says it returns apandas.core.groupby.grouper.Grouper
; however in at least some situations this function can return apandas.core.resample.DatetimeIndexResamplerGroupby
, which is not a Grouper.To Reproduce
This results in a false positive on MyPy 1.7.1:
The error message is
Please complete the following information:
Python 3.11
Mypy 1.7.1
pandas-stubs 2.1.1.230928
The text was updated successfully, but these errors were encountered: