forked from pandas-dev/pandas-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtimedeltas.pyi
88 lines (84 loc) · 3.33 KB
/
timedeltas.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
from collections.abc import (
Hashable,
Sequence,
)
import datetime as dt
from typing import (
Literal,
overload,
)
import numpy as np
from pandas import (
DateOffset,
Index,
Period,
)
from pandas.core.indexes.accessors import TimedeltaIndexProperties
from pandas.core.indexes.datetimelike import DatetimeTimedeltaMixin
from pandas.core.indexes.datetimes import DatetimeIndex
from pandas.core.indexes.period import PeriodIndex
from pandas.core.series import TimedeltaSeries
from typing_extensions import Self
from pandas._libs import (
Timedelta,
Timestamp,
)
from pandas._libs.tslibs import BaseOffset
from pandas._typing import (
AnyArrayLike,
TimedeltaConvertibleTypes,
num,
)
class TimedeltaIndex(DatetimeTimedeltaMixin[Timedelta], TimedeltaIndexProperties):
def __new__(
cls,
data: AnyArrayLike
| list[str]
| Sequence[dt.timedelta | Timedelta | np.timedelta64 | float] = ...,
unit: Literal["D", "h", "m", "s", "ms", "us", "ns"] = ...,
freq: str | BaseOffset = ...,
closed: object = ...,
dtype: Literal["<m8[ns]"] = ...,
copy: bool = ...,
name: str = ...,
) -> Self: ...
# various ignores needed for mypy, as we do want to restrict what can be used in
# arithmetic for these types
@overload
def __add__(self, other: Period) -> PeriodIndex: ...
@overload
def __add__(self, other: DatetimeIndex) -> DatetimeIndex: ...
@overload
def __add__(self, other: dt.timedelta | Timedelta | Self) -> Self: ...
def __radd__(self, other: dt.datetime | Timestamp | DatetimeIndex) -> DatetimeIndex: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def __sub__(self, other: dt.timedelta | Timedelta | Self) -> Self: ...
def __mul__(self, other: num) -> Self: ...
@overload # type: ignore[override]
def __truediv__(self, other: num | Sequence[float]) -> Self: ...
@overload
def __truediv__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: dt.timedelta | Sequence[dt.timedelta]
) -> Index[float]: ...
def __rtruediv__(self, other: dt.timedelta | Sequence[dt.timedelta]) -> Index[float]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
@overload # type: ignore[override]
def __floordiv__(self, other: num | Sequence[float]) -> Self: ...
@overload
def __floordiv__( # pyright: ignore[reportIncompatibleMethodOverride]
self, other: dt.timedelta | Sequence[dt.timedelta]
) -> Index[int]: ...
def __rfloordiv__(self, other: dt.timedelta | Sequence[dt.timedelta]) -> Index[int]: ... # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride]
def astype(self, dtype, copy: bool = ...): ...
def get_value(self, series, key): ...
def searchsorted(self, value, side: str = ..., sorter=...): ...
@property
def inferred_type(self) -> str: ...
def insert(self, loc, item): ...
def to_series(self, index=..., name=...) -> TimedeltaSeries: ...
def timedelta_range(
start: TimedeltaConvertibleTypes = ...,
end: TimedeltaConvertibleTypes = ...,
periods: int | None = ...,
freq: str | DateOffset | Timedelta | dt.timedelta | None = ...,
name: Hashable | None = ...,
closed: Literal["left", "right"] | None = ...,
) -> TimedeltaIndex: ...