diff --git a/pandas/_libs/tslibs/timestamps.pyi b/pandas/_libs/tslibs/timestamps.pyi new file mode 100644 index 0000000000000..090d4091cbe00 --- /dev/null +++ b/pandas/_libs/tslibs/timestamps.pyi @@ -0,0 +1,109 @@ +# flake8: noqa + +from typing import Any + +class RoundTo: + @property + def MINUS_INFTY(self) -> int: ... + @property + def PLUS_INFTY(self) -> int: ... + @property + def NEAREST_HALF_EVEN(self) -> int: ... + @property + def NEAREST_HALF_PLUS_INFTY(self) -> int: ... + @property + def NEAREST_HALF_MINUS_INFTY(self) -> int: ... + +def round_nsint64(values, mode, freq): ... + +class Timestamp: + value: Any = ... + freq: Any = ... + tzinfo: Any = ... + min: Any = ... + max: Any = ... + weekofyear: Any = ... + daysinmonth: Any = ... + astimezone: Any = ... + def fromordinal(cls, ordinal, freq=..., tz=...): ... + def now(cls, tz=...): ... + def today(cls, tz=...): ... + def utcnow(cls): ... + def utcfromtimestamp(cls, ts): ... + def fromtimestamp(cls, ts): ... + def strptime(cls, date_string, format): ... + def combine(cls, date, time): ... + def __new__( + cls, + ts_input=..., + freq=..., + tz=..., + unit=..., + year=..., + month=..., + day=..., + hour=..., + minute=..., + second=..., + microsecond=..., + nanosecond=..., + tzinfo=..., + ): ... + def round(self, freq, ambiguous=..., nonexistent=...): ... + def floor(self, freq, ambiguous=..., nonexistent=...): ... + def ceil(self, freq, ambiguous=..., nonexistent=...): ... + @property + def tz(self): ... + @tz.setter + def tz(self, value): ... + def to_period(self, freq=...): ... + @property + def dayofweek(self): ... + def day_name(self, locale=...): ... + def month_name(self, locale=...): ... + @property + def weekday_name(self): ... + @property + def dayofyear(self): ... + @property + def week(self): ... + @property + def quarter(self): ... + @property + def days_in_month(self): ... + @property + def freqstr(self): ... + @property + def is_month_start(self): ... + @property + def is_month_end(self): ... + @property + def is_quarter_start(self): ... + @property + def is_quarter_end(self): ... + @property + def is_year_start(self): ... + @property + def is_year_end(self): ... + @property + def is_leap_year(self): ... + @property + def resolution(self): ... + def tz_localize(self, tz, ambiguous=..., nonexistent=..., errors=...): ... + def tz_convert(self, tz): ... + def replace( + self, + year=..., + month=..., + day=..., + hour=..., + minute=..., + second=..., + microsecond=..., + nanosecond=..., + tzinfo=..., + fold=..., + ): ... + def isoformat(self, sep=...): ... + def to_julian_date(self): ... + def normalize(self): ... diff --git a/pandas/core/arrays/datetimes.py b/pandas/core/arrays/datetimes.py index 70df708d36b3b..fed9ed9745889 100644 --- a/pandas/core/arrays/datetimes.py +++ b/pandas/core/arrays/datetimes.py @@ -272,7 +272,10 @@ class DatetimeArray(dtl.DatetimeLikeArrayMixin, dtl.TimelikeOps, dtl.DatelikeOps """ _typ = "datetimearray" - _scalar_type = Timestamp + + @property + def _scalar_type(self): + return Timestamp # define my properties & methods for delegation _bool_ops = [ diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index f2d74794eadf5..feb8a0c9e8120 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -162,7 +162,10 @@ class PeriodArray(dtl.DatetimeLikeArrayMixin, dtl.DatelikeOps): # array priority higher than numpy scalars __array_priority__ = 1000 _typ = "periodarray" # ABCPeriodArray - _scalar_type = Period + + @property + def _scalar_type(self): + return Period # Names others delegate to us _other_ops = [] # type: List[str] diff --git a/pandas/core/arrays/timedeltas.py b/pandas/core/arrays/timedeltas.py index 3609c68a26c0f..17ba812ac58c3 100644 --- a/pandas/core/arrays/timedeltas.py +++ b/pandas/core/arrays/timedeltas.py @@ -157,7 +157,11 @@ class TimedeltaArray(dtl.DatetimeLikeArrayMixin, dtl.TimelikeOps): """ _typ = "timedeltaarray" - _scalar_type = Timedelta + + @property + def _scalar_type(self): + return Timedelta + __array_priority__ = 1000 # define my properties & methods for delegation _other_ops = [] # type: List[str]