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
It technically also allows integers/floats. period_range internally uses Period to convert the start and end arguments, so the type annotations can be used interchangeably between those two.
To Reproduce
importpandasaspdpd.Period(pd.Timestamp('2020-01-01'), freq='Q') # mypy: arg-type — Argument 1 to "Period" has incompatible type "Timestamp"pd.period_range(pd.Timestamp('2020-01-01), '2020-06-01', freq='Q') # mypy: arg-type — Argument 1 to "period_range" has incompatible type "Timestamp"
OS: Linux (OpenSUSE Tumbleweed)
Python 3.10
mypy 1.0.1
pandas-stubs 2.0.1.230501
The text was updated successfully, but these errors were encountered:
For the stubs, we generally follow what is documented, and while the implementation does accept datetime, date, and pd.Timestamp, and maybe even int or float, the docs just say Period or str, so we'd have to find out if that is an error in the implementation or a documentation issue.
Can you open up an issue in the pandas repo about the docs, and once that is resolved, we can address the stubs?
pd.period_range
andpd.Period
currently only acceptstr
andpd.Period
as arguments, but the implementation also acceptsdatetime
,date
andpd.Timestamp
as can be seen here in the cython implementation: https://github.com/pandas-dev/pandas/blob/v2.0.1/pandas/_libs/tslibs/period.pyx#L2626-L2643It technically also allows integers/floats.
period_range
internally usesPeriod
to convert thestart
andend
arguments, so the type annotations can be used interchangeably between those two.To Reproduce
The text was updated successfully, but these errors were encountered: