|
1 |
| -from datetime import tzinfo |
| 1 | +from typing import Sequence |
2 | 2 |
|
3 | 3 | import numpy as np
|
| 4 | +from pandas.core.arrays.datetimelike import ( |
| 5 | + DatelikeOps, |
| 6 | + DatetimeLikeArrayMixin, |
| 7 | +) |
4 | 8 |
|
5 |
| -from pandas._libs.tslibs.nattype import NaTType |
6 |
| -from pandas._libs.tslibs.offsets import BaseOffset |
| 9 | +from pandas._libs.tslibs import Period |
7 | 10 | from pandas._libs.tslibs.timestamps import Timestamp
|
8 | 11 | from pandas._typing import npt as npt
|
9 | 12 |
|
10 |
| -class PeriodMixin: |
11 |
| - @property |
12 |
| - def end_time(self) -> Timestamp: ... |
13 |
| - @property |
14 |
| - def start_time(self) -> Timestamp: ... |
| 13 | +from pandas.tseries.offsets import Tick |
15 | 14 |
|
16 |
| -class Period(PeriodMixin): |
17 |
| - ordinal: int |
18 |
| - freq: BaseOffset |
19 |
| - def __new__( |
20 |
| - cls, |
21 |
| - value: Period | str = ..., |
22 |
| - freq: int | str | BaseOffset | None = ..., |
23 |
| - ordinal: int | None = ..., |
24 |
| - year: int | None = ..., |
25 |
| - month: int | None = ..., |
26 |
| - quarter: int | None = ..., |
27 |
| - day: int | None = ..., |
28 |
| - hour: int | None = ..., |
29 |
| - minute: int | None = ..., |
30 |
| - second: int | None = ..., |
31 |
| - ) -> Period | NaTType: ... |
32 |
| - @classmethod |
33 |
| - def now(cls, freq: BaseOffset = ...) -> Period: ... |
34 |
| - def strftime(self, fmt: str) -> str: ... |
35 |
| - def to_timestamp( |
36 |
| - self, |
37 |
| - freq: str | BaseOffset | None = ..., |
38 |
| - how: str = ..., |
39 |
| - tz: str | tzinfo | None = ..., |
40 |
| - ) -> Timestamp: ... |
41 |
| - def asfreq(self, freq: str | BaseOffset, how: str = ...) -> Period: ... |
42 |
| - @property |
43 |
| - def freqstr(self) -> str: ... |
| 15 | +class PeriodArray(DatetimeLikeArrayMixin, DatelikeOps): |
| 16 | + __array_priority__: int = ... |
| 17 | + def __init__(self, values, freq=..., dtype=..., copy: bool = ...) -> None: ... |
| 18 | + def dtype(self): ... |
| 19 | + def __array__(self, dtype=...) -> np.ndarray: ... |
| 20 | + def __arrow_array__(self, type=...): ... |
| 21 | + year: int = ... |
| 22 | + month: int = ... |
| 23 | + day: int = ... |
| 24 | + hour: int = ... |
| 25 | + minute: int = ... |
| 26 | + second: int = ... |
| 27 | + weekofyear: int = ... |
| 28 | + week: int = ... |
| 29 | + dayofweek: int = ... |
| 30 | + weekday: int = ... |
| 31 | + dayofyear: int = ... |
| 32 | + day_of_year = ... |
| 33 | + quarter: int = ... |
| 34 | + qyear: int = ... |
| 35 | + days_in_month: int = ... |
| 36 | + daysinmonth: int = ... |
44 | 37 | @property
|
45 | 38 | def is_leap_year(self) -> bool: ...
|
46 | 39 | @property
|
47 |
| - def daysinmonth(self) -> int: ... |
48 |
| - @property |
49 |
| - def days_in_month(self) -> int: ... |
50 |
| - @property |
51 |
| - def qyear(self) -> int: ... |
52 |
| - @property |
53 |
| - def quarter(self) -> int: ... |
54 |
| - @property |
55 |
| - def day_of_year(self) -> int: ... |
56 |
| - @property |
57 |
| - def weekday(self) -> int: ... |
58 |
| - @property |
59 |
| - def day_of_week(self) -> int: ... |
60 |
| - @property |
61 |
| - def week(self) -> int: ... |
62 |
| - @property |
63 |
| - def weekofyear(self) -> int: ... |
64 |
| - @property |
65 |
| - def second(self) -> int: ... |
66 |
| - @property |
67 |
| - def minute(self) -> int: ... |
68 |
| - @property |
69 |
| - def hour(self) -> int: ... |
70 |
| - @property |
71 |
| - def day(self) -> int: ... |
72 |
| - @property |
73 |
| - def month(self) -> int: ... |
| 40 | + def start_time(self) -> Timestamp: ... |
74 | 41 | @property
|
75 |
| - def year(self) -> int: ... |
76 |
| - def __sub__(self, other) -> Period | BaseOffset: ... |
77 |
| - def __add__(self, other) -> Period: ... |
| 42 | + def end_time(self) -> Timestamp: ... |
78 | 43 | def to_timestamp(self, freq: str | None = ..., how: str = ...) -> Timestamp: ...
|
79 | 44 | def asfreq(self, freq: str | None = ..., how: str = ...) -> Period: ...
|
80 | 45 | def astype(self, dtype, copy: bool = ...): ...
|
| 46 | + |
| 47 | +def period_array( |
| 48 | + data: Sequence[Period | None], |
| 49 | + freq: str | Tick | None = ..., |
| 50 | + copy: bool = ..., |
| 51 | +) -> PeriodArray: ... |
0 commit comments