Skip to content

Commit 046e696

Browse files
committed
restore DateOffset
1 parent 1bfd52a commit 046e696

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

pandas-stubs/_libs/tslibs/period.pyi

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,10 @@ from pandas import (
1515
from typing_extensions import TypeAlias
1616

1717
from pandas._libs.tslibs import NaTType
18-
from pandas._libs.tslibs.offsets import BaseOffset
18+
from pandas._libs.tslibs.offsets import (
19+
BaseOffset,
20+
DateOffset,
21+
)
1922
from pandas._libs.tslibs.timestamps import Timestamp
2023
from pandas._typing import (
2124
Frequency,
@@ -233,6 +236,6 @@ class Period(PeriodMixin):
233236
def strftime(self, fmt: str) -> str: ...
234237
def to_timestamp(
235238
self,
236-
freq: Frequency | None = ...,
239+
freq: str | DateOffset | None = ...,
237240
how: _PeriodToTimestampHow = "S",
238241
) -> Timestamp: ...

pandas-stubs/core/arrays/period.pyi

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ from pandas.core.arrays.datetimelike import (
66
)
77

88
from pandas._libs.tslibs import Timestamp
9+
from pandas._libs.tslibs.offsets import DateOffset
910
from pandas._libs.tslibs.period import Period
1011

1112
class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps):
@@ -37,6 +38,8 @@ class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps):
3738
def start_time(self) -> Timestamp: ...
3839
@property
3940
def end_time(self) -> Timestamp: ...
40-
def to_timestamp(self, freq: str | None = ..., how: str = ...) -> Timestamp: ...
41+
def to_timestamp(
42+
self, freq: str | DateOffset | None = None, how: str = ...
43+
) -> Timestamp: ...
4144
def asfreq(self, freq: str | None = ..., how: str = "E") -> Period: ...
4245
def astype(self, dtype, copy: bool = True): ...

pandas-stubs/core/series.pyi

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1237,7 +1237,7 @@ class Series(IndexOpsMixin[S1], NDFrame):
12371237
) -> Series[S1]: ...
12381238
def to_timestamp(
12391239
self,
1240-
freq: Frequency | None = None,
1240+
freq: str | DateOffset | None = None,
12411241
how: ToTimestampHow = "start",
12421242
copy: _bool = True,
12431243
) -> Series[S1]: ...

0 commit comments

Comments
 (0)