forked from pandas-dev/pandas-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdatetimes.pyi
115 lines (109 loc) · 3.8 KB
/
datetimes.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
from datetime import (
timedelta,
tzinfo,
)
from typing import overload
import numpy as np
from pandas import (
DataFrame,
Timedelta,
TimedeltaIndex,
Timestamp,
)
from pandas.core.indexes.accessors import DatetimeIndexProperties
from pandas.core.indexes.api import Float64Index
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
from pandas.core.series import (
TimedeltaSeries,
TimestampSeries,
)
from pandas._typing import (
AnyArrayLike,
ArrayLike,
DatetimeLike,
IntervalClosedType,
np_ndarray_bool,
)
from pandas.core.dtypes.dtypes import DatetimeTZDtype
from pandas.tseries.offsets import BaseOffset
class DatetimeIndex(DatetimeTimedeltaMixin, DatetimeIndexProperties):
tz: tzinfo | None
def __init__(
self,
data: ArrayLike | AnyArrayLike | list | tuple,
freq=...,
tz=...,
normalize: bool = ...,
closed=...,
ambiguous: str = ...,
dayfirst: bool = ...,
yearfirst: bool = ...,
dtype=...,
copy: bool = ...,
name=...,
): ...
def __array__(self, dtype=...) -> np.ndarray: ...
def __reduce__(self): ...
# various ignores needed for mypy, as we do want to restrict what can be used in
# arithmetic for these types
@overload # type: ignore[override]
def __add__(self, other: TimedeltaSeries) -> TimestampSeries: ...
@overload
def __add__(self, other: Timedelta | TimedeltaIndex) -> DatetimeIndex: ...
@overload # type: ignore[override]
def __sub__(self, other: TimedeltaSeries) -> TimestampSeries: ...
@overload
def __sub__(self, other: Timedelta | TimedeltaIndex) -> DatetimeIndex: ...
@overload
def __sub__(self, other: Timestamp | DatetimeIndex) -> TimedeltaIndex: ...
# overload needed because Index.to_series() and DatetimeIndex.to_series() have
# different arguments
def to_series(self, keep_tz=..., index=..., name=...) -> TimestampSeries: ... # type: ignore[override]
def snap(self, freq: str = ...): ...
def get_value(self, series, key): ...
def get_loc(self, key, tolerance=...): ...
def slice_indexer(self, start=..., end=..., step=...): ...
def searchsorted(self, value, side: str = ..., sorter=...): ...
def is_type_compatible(self, typ) -> bool: ...
@property
def inferred_type(self) -> str: ...
def insert(self, loc, item): ...
def indexer_at_time(self, time, asof: bool = ...): ...
def indexer_between_time(
self, start_time, end_time, include_start: bool = ..., include_end: bool = ...
): ...
def to_perioddelta(self, freq) -> TimedeltaIndex: ...
def to_julian_date(self) -> Float64Index: ...
def isocalendar(self) -> DataFrame: ...
@property
def tzinfo(self) -> tzinfo | None: ...
def __lt__(self, other: Timestamp) -> np_ndarray_bool: ...
def __le__(self, other: Timestamp) -> np_ndarray_bool: ...
def __gt__(self, other: Timestamp) -> np_ndarray_bool: ...
def __ge__(self, other: Timestamp) -> np_ndarray_bool: ...
@property
def dtype(self) -> np.dtype | DatetimeTZDtype: ...
def date_range(
start: str | DatetimeLike | None = ...,
end: str | DatetimeLike | None = ...,
periods: int | None = ...,
freq: str | timedelta | BaseOffset = ...,
tz: str | tzinfo = ...,
normalize: bool = ...,
name: str | None = ...,
inclusive: IntervalClosedType = ...,
**kwargs,
) -> DatetimeIndex: ...
def bdate_range(
start: str | DatetimeLike | None = ...,
end: str | DatetimeLike | None = ...,
periods: int | None = ...,
freq: str | timedelta | BaseOffset = ...,
tz: str | tzinfo = ...,
normalize: bool = ...,
name: str | None = ...,
weekmask: str | None = ...,
holidays: list | None = ...,
inclusive: IntervalClosedType = ...,
**kwargs,
) -> DatetimeIndex: ...