sidsenthilkumar commited on
Commit
690d5a8
·
verified ·
1 Parent(s): 9f87349

Upload folder using huggingface_hub (part 5)

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +14 -0
  2. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/fields.pyi +62 -0
  3. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/nattype.cpython-311-aarch64-linux-gnu.so +3 -0
  4. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/nattype.pyi +184 -0
  5. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/np_datetime.cpython-311-aarch64-linux-gnu.so +3 -0
  6. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/np_datetime.pyi +27 -0
  7. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/offsets.cpython-311-aarch64-linux-gnu.so +3 -0
  8. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/offsets.pyi +308 -0
  9. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/parsing.cpython-311-aarch64-linux-gnu.so +3 -0
  10. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/parsing.pyi +30 -0
  11. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/period.cpython-311-aarch64-linux-gnu.so +3 -0
  12. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/period.pyi +135 -0
  13. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/strptime.cpython-311-aarch64-linux-gnu.so +3 -0
  14. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/strptime.pyi +14 -0
  15. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timedeltas.cpython-311-aarch64-linux-gnu.so +3 -0
  16. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timedeltas.pyi +168 -0
  17. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timestamps.cpython-311-aarch64-linux-gnu.so +3 -0
  18. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timestamps.pyi +242 -0
  19. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timezones.cpython-311-aarch64-linux-gnu.so +3 -0
  20. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timezones.pyi +21 -0
  21. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/tzconversion.cpython-311-aarch64-linux-gnu.so +3 -0
  22. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/tzconversion.pyi +21 -0
  23. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/vectorized.cpython-311-aarch64-linux-gnu.so +3 -0
  24. .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/vectorized.pyi +41 -0
  25. .venv/lib/python3.11/site-packages/pandas/_libs/window/__init__.py +0 -0
  26. .venv/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-aarch64-linux-gnu.so +3 -0
  27. .venv/lib/python3.11/site-packages/pandas/_libs/window/aggregations.pyi +145 -0
  28. .venv/lib/python3.11/site-packages/pandas/_libs/window/indexers.cpython-311-aarch64-linux-gnu.so +3 -0
  29. .venv/lib/python3.11/site-packages/pandas/_libs/window/indexers.pyi +12 -0
  30. .venv/lib/python3.11/site-packages/pandas/_libs/writers.cpython-311-aarch64-linux-gnu.so +3 -0
  31. .venv/lib/python3.11/site-packages/pandas/_libs/writers.pyi +20 -0
  32. .venv/lib/python3.11/site-packages/pandas/_testing/__init__.py +645 -0
  33. .venv/lib/python3.11/site-packages/pandas/_testing/_hypothesis.py +89 -0
  34. .venv/lib/python3.11/site-packages/pandas/_testing/_io.py +129 -0
  35. .venv/lib/python3.11/site-packages/pandas/_testing/_warnings.py +266 -0
  36. .venv/lib/python3.11/site-packages/pandas/_testing/asserters.py +1503 -0
  37. .venv/lib/python3.11/site-packages/pandas/_testing/compat.py +30 -0
  38. .venv/lib/python3.11/site-packages/pandas/_testing/contexts.py +151 -0
  39. .venv/lib/python3.11/site-packages/pandas/_typing.py +578 -0
  40. .venv/lib/python3.11/site-packages/pandas/_version.py +692 -0
  41. .venv/lib/python3.11/site-packages/pandas/_version_meson.py +2 -0
  42. .venv/lib/python3.11/site-packages/pandas/api/__init__.py +19 -0
  43. .venv/lib/python3.11/site-packages/pandas/api/executors/__init__.py +7 -0
  44. .venv/lib/python3.11/site-packages/pandas/api/extensions/__init__.py +33 -0
  45. .venv/lib/python3.11/site-packages/pandas/api/indexers/__init__.py +17 -0
  46. .venv/lib/python3.11/site-packages/pandas/api/interchange/__init__.py +8 -0
  47. .venv/lib/python3.11/site-packages/pandas/api/internals.py +62 -0
  48. .venv/lib/python3.11/site-packages/pandas/api/types/__init__.py +23 -0
  49. .venv/lib/python3.11/site-packages/pandas/api/typing/__init__.py +61 -0
  50. .venv/lib/python3.11/site-packages/pandas/api/typing/aliases.py +145 -0
.gitattributes CHANGED
@@ -68,3 +68,17 @@
68
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/conversion.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
69
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/dtypes.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
70
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/fields.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/conversion.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
69
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/dtypes.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
70
  .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/fields.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
71
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/nattype.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
72
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/np_datetime.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
73
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/offsets.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
74
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/parsing.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
75
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/period.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
76
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/strptime.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
77
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timedeltas.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
78
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timestamps.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
79
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timezones.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
80
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/tzconversion.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
81
+ .venv/lib/python3.11/site-packages/pandas/_libs/tslibs/vectorized.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
82
+ .venv/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
83
+ .venv/lib/python3.11/site-packages/pandas/_libs/window/indexers.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
84
+ .venv/lib/python3.11/site-packages/pandas/_libs/writers.cpython-311-aarch64-linux-gnu.so filter=lfs diff=lfs merge=lfs -text
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/fields.pyi ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import npt
4
+
5
+ def build_field_sarray(
6
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
7
+ reso: int, # NPY_DATETIMEUNIT
8
+ ) -> np.ndarray: ...
9
+ def month_position_check(fields, weekdays) -> str | None: ...
10
+ def get_date_name_field(
11
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
12
+ field: str,
13
+ locale: str | None = ...,
14
+ reso: int = ..., # NPY_DATETIMEUNIT
15
+ ) -> npt.NDArray[np.object_]: ...
16
+ def get_start_end_field(
17
+ dtindex: npt.NDArray[np.int64],
18
+ field: str,
19
+ freq_name: str | None = ...,
20
+ month_kw: int = ...,
21
+ reso: int = ..., # NPY_DATETIMEUNIT
22
+ ) -> npt.NDArray[np.bool_]: ...
23
+ def get_date_field(
24
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
25
+ field: str,
26
+ reso: int = ..., # NPY_DATETIMEUNIT
27
+ ) -> npt.NDArray[np.int32]: ...
28
+ def get_timedelta_field(
29
+ tdindex: npt.NDArray[np.int64], # const int64_t[:]
30
+ field: str,
31
+ reso: int = ..., # NPY_DATETIMEUNIT
32
+ ) -> npt.NDArray[np.int32]: ...
33
+ def get_timedelta_days(
34
+ tdindex: npt.NDArray[np.int64], # const int64_t[:]
35
+ reso: int = ..., # NPY_DATETIMEUNIT
36
+ ) -> npt.NDArray[np.int64]: ...
37
+ def isleapyear_arr(
38
+ years: np.ndarray,
39
+ ) -> npt.NDArray[np.bool_]: ...
40
+ def build_isocalendar_sarray(
41
+ dtindex: npt.NDArray[np.int64], # const int64_t[:]
42
+ reso: int, # NPY_DATETIMEUNIT
43
+ ) -> np.ndarray: ...
44
+ def _get_locale_names(name_type: str, locale: str | None = ...): ...
45
+
46
+ class RoundTo:
47
+ @property
48
+ def MINUS_INFTY(self) -> int: ...
49
+ @property
50
+ def PLUS_INFTY(self) -> int: ...
51
+ @property
52
+ def NEAREST_HALF_EVEN(self) -> int: ...
53
+ @property
54
+ def NEAREST_HALF_PLUS_INFTY(self) -> int: ...
55
+ @property
56
+ def NEAREST_HALF_MINUS_INFTY(self) -> int: ...
57
+
58
+ def round_nsint64(
59
+ values: npt.NDArray[np.int64],
60
+ mode: RoundTo,
61
+ nanos: int,
62
+ ) -> npt.NDArray[np.int64]: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/nattype.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a4af77495802b6749710010a5bd9a0c930ed36c2961be1374a6637a20878926
3
+ size 270096
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/nattype.pyi ADDED
@@ -0,0 +1,184 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ datetime,
3
+ timedelta,
4
+ tzinfo as _tzinfo,
5
+ )
6
+ from typing import (
7
+ Literal,
8
+ NoReturn,
9
+ Self,
10
+ TypeAlias,
11
+ overload,
12
+ )
13
+
14
+ import numpy as np
15
+
16
+ from pandas._libs.tslibs.period import Period
17
+ from pandas._typing import (
18
+ Frequency,
19
+ TimestampNonexistent,
20
+ TimeUnit,
21
+ )
22
+
23
+ NaT: NaTType
24
+ iNaT: int
25
+ nat_strings: set[str]
26
+
27
+ _TimeLike: TypeAlias = datetime | timedelta | Period | np.datetime64 | np.timedelta64
28
+ _TimeDelta: TypeAlias = timedelta | np.timedelta64
29
+
30
+ class NaTType:
31
+ _value: np.int64
32
+ @property
33
+ def value(self) -> int: ...
34
+ @property
35
+ def asm8(self) -> np.datetime64: ...
36
+ def to_datetime64(self) -> np.datetime64: ...
37
+ def to_numpy(
38
+ self, dtype: np.dtype | str | None = ..., copy: bool = ...
39
+ ) -> np.datetime64 | np.timedelta64: ...
40
+ @property
41
+ def is_leap_year(self) -> bool: ...
42
+ @property
43
+ def is_month_start(self) -> bool: ...
44
+ @property
45
+ def is_quarter_start(self) -> bool: ...
46
+ @property
47
+ def is_year_start(self) -> bool: ...
48
+ @property
49
+ def is_month_end(self) -> bool: ...
50
+ @property
51
+ def is_quarter_end(self) -> bool: ...
52
+ @property
53
+ def is_year_end(self) -> bool: ...
54
+ @property
55
+ def day_of_year(self) -> float: ...
56
+ @property
57
+ def dayofyear(self) -> float: ...
58
+ @property
59
+ def days_in_month(self) -> float: ...
60
+ @property
61
+ def daysinmonth(self) -> float: ...
62
+ @property
63
+ def day_of_week(self) -> float: ...
64
+ @property
65
+ def dayofweek(self) -> float: ...
66
+ @property
67
+ def week(self) -> float: ...
68
+ @property
69
+ def weekofyear(self) -> float: ...
70
+ @property
71
+ def fold(self) -> int: ...
72
+ def day_name(self) -> float: ...
73
+ def month_name(self) -> float: ...
74
+ def weekday(self) -> float: ...
75
+ def isoweekday(self) -> float: ...
76
+ def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
77
+ def strftime(self, format: str) -> NoReturn: ...
78
+ def total_seconds(self) -> float: ...
79
+ def today(self, *args, **kwargs) -> NaTType: ...
80
+ def now(self, *args, **kwargs) -> NaTType: ...
81
+ def to_pydatetime(self) -> NaTType: ...
82
+ def date(self) -> NaTType: ...
83
+ def round(
84
+ self,
85
+ freq: Frequency,
86
+ ambiguous: bool | Literal["raise"] | NaTType = ...,
87
+ nonexistent: TimestampNonexistent = ...,
88
+ ) -> NaTType: ...
89
+ def floor(
90
+ self,
91
+ freq: Frequency,
92
+ ambiguous: bool | Literal["raise"] | NaTType = ...,
93
+ nonexistent: TimestampNonexistent = ...,
94
+ ) -> NaTType: ...
95
+ def ceil(
96
+ self,
97
+ freq: Frequency,
98
+ ambiguous: bool | Literal["raise"] | NaTType = ...,
99
+ nonexistent: TimestampNonexistent = ...,
100
+ ) -> NaTType: ...
101
+ @property
102
+ def tzinfo(self) -> None: ...
103
+ @property
104
+ def tz(self) -> None: ...
105
+ def tz_convert(self, tz: _tzinfo | str | None) -> NaTType: ...
106
+ def tz_localize(
107
+ self,
108
+ tz: _tzinfo | str | None,
109
+ ambiguous: bool | Literal["raise"] | NaTType = ...,
110
+ nonexistent: TimestampNonexistent = ...,
111
+ ) -> NaTType: ...
112
+ def replace(
113
+ self,
114
+ year: int | None = ...,
115
+ month: int | None = ...,
116
+ day: int | None = ...,
117
+ hour: int | None = ...,
118
+ minute: int | None = ...,
119
+ second: int | None = ...,
120
+ microsecond: int | None = ...,
121
+ nanosecond: int | None = ...,
122
+ tzinfo: _tzinfo | None = ...,
123
+ fold: int | None = ...,
124
+ ) -> NaTType: ...
125
+ @property
126
+ def year(self) -> float: ...
127
+ @property
128
+ def quarter(self) -> float: ...
129
+ @property
130
+ def month(self) -> float: ...
131
+ @property
132
+ def day(self) -> float: ...
133
+ @property
134
+ def hour(self) -> float: ...
135
+ @property
136
+ def minute(self) -> float: ...
137
+ @property
138
+ def second(self) -> float: ...
139
+ @property
140
+ def millisecond(self) -> float: ...
141
+ @property
142
+ def microsecond(self) -> float: ...
143
+ @property
144
+ def nanosecond(self) -> float: ...
145
+ # inject Timedelta properties
146
+ @property
147
+ def days(self) -> float: ...
148
+ @property
149
+ def seconds(self) -> float: ...
150
+ @property
151
+ def microseconds(self) -> float: ...
152
+ @property
153
+ def nanoseconds(self) -> float: ...
154
+ # inject Period properties
155
+ @property
156
+ def qyear(self) -> float: ...
157
+ # comparisons
158
+ def __eq__(self, other: object, /) -> Literal[False]: ...
159
+ def __ne__(self, other: object, /) -> Literal[True]: ...
160
+ def __lt__(self, other: Self | _TimeLike, /) -> Literal[False]: ...
161
+ def __le__(self, other: Self | _TimeLike, /) -> Literal[False]: ...
162
+ def __gt__(self, other: Self | _TimeLike, /) -> Literal[False]: ...
163
+ def __ge__(self, other: Self | _TimeLike, /) -> Literal[False]: ...
164
+ # unary operators
165
+ def __pos__(self) -> Self: ...
166
+ def __neg__(self) -> Self: ...
167
+ # binary operators
168
+ def __sub__(self, other: Self | _TimeLike, /) -> Self: ...
169
+ def __rsub__(self, other: Self | _TimeLike, /) -> Self: ...
170
+ def __add__(self, other: Self | _TimeLike, /) -> Self: ...
171
+ def __radd__(self, other: Self | _TimeLike, /) -> Self: ...
172
+ def __mul__(self, other: float, /) -> Self: ... # analogous to timedelta
173
+ def __rmul__(self, other: float, /) -> Self: ...
174
+ @overload # analogous to timedelta
175
+ def __truediv__(self, other: Self | _TimeDelta, /) -> float: ... # Literal[NaN]
176
+ @overload
177
+ def __truediv__(self, other: float, /) -> Self: ...
178
+ @overload # analogous to timedelta
179
+ def __floordiv__(self, other: Self | _TimeDelta, /) -> float: ... # Literal[NaN]
180
+ @overload
181
+ def __floordiv__(self, other: float, /) -> Self: ...
182
+ # other
183
+ def __hash__(self) -> int: ...
184
+ def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> NaTType: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/np_datetime.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:82018658bd689a1c836eab7df2708d6ff554666f748bf31b6c461c064be1af1e
3
+ size 267640
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/np_datetime.pyi ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import npt
4
+
5
+ class OutOfBoundsDatetime(ValueError): ...
6
+ class OutOfBoundsTimedelta(ValueError): ...
7
+
8
+ # only exposed for testing
9
+ def py_get_unit_from_dtype(dtype: np.dtype): ...
10
+ def py_td64_to_tdstruct(td64: int, unit: int) -> dict: ...
11
+ def astype_overflowsafe(
12
+ values: np.ndarray,
13
+ dtype: np.dtype,
14
+ copy: bool = ...,
15
+ round_ok: bool = ...,
16
+ is_coerce: bool = ...,
17
+ ) -> np.ndarray: ...
18
+ def is_unitless(dtype: np.dtype) -> bool: ...
19
+ def compare_mismatched_resolutions(
20
+ left: np.ndarray, right: np.ndarray, op
21
+ ) -> npt.NDArray[np.bool_]: ...
22
+ def add_overflowsafe(
23
+ left: npt.NDArray[np.int64],
24
+ right: npt.NDArray[np.int64],
25
+ ) -> npt.NDArray[np.int64]: ...
26
+ def get_supported_dtype(dtype: np.dtype) -> np.dtype: ...
27
+ def is_supported_dtype(dtype: np.dtype) -> bool: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/offsets.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:13e1f38b91c4c9238672e7d3898da51a3ca41e6e6f5f1e507a2bcbdebfaa5c65
3
+ size 1011920
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/offsets.pyi ADDED
@@ -0,0 +1,308 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Collection
2
+ from datetime import (
3
+ datetime,
4
+ time,
5
+ timedelta,
6
+ )
7
+ from typing import (
8
+ Any,
9
+ Literal,
10
+ Self,
11
+ TypeVar,
12
+ overload,
13
+ )
14
+
15
+ import numpy as np
16
+
17
+ from pandas._libs.tslibs.nattype import NaTType
18
+ from pandas._typing import (
19
+ OffsetCalendar,
20
+ npt,
21
+ )
22
+
23
+ _BaseOffsetT = TypeVar("_BaseOffsetT", bound=BaseOffset)
24
+ _DatetimeT = TypeVar("_DatetimeT", bound=datetime)
25
+ _TimedeltaT = TypeVar("_TimedeltaT", bound=timedelta)
26
+
27
+ _relativedelta_kwds: set[str]
28
+ prefix_mapping: dict[str, type]
29
+
30
+ class ApplyTypeError(TypeError): ...
31
+
32
+ class BaseOffset:
33
+ n: int
34
+ normalize: bool
35
+ def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
36
+ def __eq__(self, other) -> bool: ...
37
+ def __ne__(self, other) -> bool: ...
38
+ def __hash__(self) -> int: ...
39
+ @property
40
+ def kwds(self) -> dict: ...
41
+ @property
42
+ def base(self) -> BaseOffset: ...
43
+ @overload
44
+ def __add__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
45
+ @overload
46
+ def __add__(self, other: BaseOffset) -> Self: ...
47
+ @overload
48
+ def __add__(self, other: _DatetimeT) -> _DatetimeT: ...
49
+ @overload
50
+ def __add__(self, other: _TimedeltaT) -> _TimedeltaT: ...
51
+ @overload
52
+ def __radd__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
53
+ @overload
54
+ def __radd__(self, other: BaseOffset) -> Self: ...
55
+ @overload
56
+ def __radd__(self, other: _DatetimeT) -> _DatetimeT: ...
57
+ @overload
58
+ def __radd__(self, other: _TimedeltaT) -> _TimedeltaT: ...
59
+ @overload
60
+ def __radd__(self, other: NaTType) -> NaTType: ...
61
+ def __sub__(self, other: BaseOffset) -> Self: ...
62
+ @overload
63
+ def __rsub__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ...
64
+ @overload
65
+ def __rsub__(self, other: BaseOffset) -> Self: ...
66
+ @overload
67
+ def __rsub__(self, other: _DatetimeT) -> _DatetimeT: ...
68
+ @overload
69
+ def __rsub__(self, other: _TimedeltaT) -> _TimedeltaT: ...
70
+ @overload
71
+ def __mul__(self, other: np.ndarray) -> np.ndarray: ...
72
+ @overload
73
+ def __mul__(self, other: int) -> Self: ...
74
+ @overload
75
+ def __rmul__(self, other: np.ndarray) -> np.ndarray: ...
76
+ @overload
77
+ def __rmul__(self, other: int) -> Self: ...
78
+ def __neg__(self) -> Self: ...
79
+ def copy(self) -> Self: ...
80
+ @property
81
+ def name(self) -> str: ...
82
+ @property
83
+ def rule_code(self) -> str: ...
84
+ @property
85
+ def freqstr(self) -> str: ...
86
+ def _apply(self, other): ...
87
+ def _apply_array(self, dtarr: np.ndarray) -> np.ndarray: ...
88
+ def rollback(self, dt: datetime) -> datetime: ...
89
+ def rollforward(self, dt: datetime) -> datetime: ...
90
+ def is_on_offset(self, dt: datetime) -> bool: ...
91
+ def __setstate__(self, state) -> None: ...
92
+ def __getstate__(self): ...
93
+ @property
94
+ def nanos(self) -> int: ...
95
+
96
+ def _get_offset(name: str) -> BaseOffset: ...
97
+
98
+ class SingleConstructorOffset(BaseOffset):
99
+ @classmethod
100
+ def _from_name(cls, suffix: None = ...) -> Self: ...
101
+ def __reduce__(self): ...
102
+
103
+ @overload
104
+ def to_offset(freq: None, is_period: bool = ...) -> None: ...
105
+ @overload
106
+ def to_offset(freq: _BaseOffsetT, is_period: bool = ...) -> _BaseOffsetT: ...
107
+ @overload
108
+ def to_offset(freq: timedelta | str, is_period: bool = ...) -> BaseOffset: ...
109
+
110
+ class Tick(SingleConstructorOffset):
111
+ _creso: int
112
+ _prefix: str
113
+ def __init__(self, n: int = ..., normalize: bool = ...) -> None: ...
114
+ @property
115
+ def nanos(self) -> int: ...
116
+
117
+ def delta_to_tick(delta: timedelta) -> Tick: ...
118
+
119
+ class Day(BaseOffset): ...
120
+ class Hour(Tick): ...
121
+ class Minute(Tick): ...
122
+ class Second(Tick): ...
123
+ class Milli(Tick): ...
124
+ class Micro(Tick): ...
125
+ class Nano(Tick): ...
126
+
127
+ class RelativeDeltaOffset(BaseOffset):
128
+ def __init__(self, n: int = ..., normalize: bool = ..., **kwds: Any) -> None: ...
129
+
130
+ class BusinessMixin(SingleConstructorOffset):
131
+ def __init__(
132
+ self, n: int = ..., normalize: bool = ..., offset: timedelta = ...
133
+ ) -> None: ...
134
+
135
+ class BusinessDay(BusinessMixin): ...
136
+
137
+ class BusinessHour(BusinessMixin):
138
+ def __init__(
139
+ self,
140
+ n: int = ...,
141
+ normalize: bool = ...,
142
+ start: str | time | Collection[str | time] = ...,
143
+ end: str | time | Collection[str | time] = ...,
144
+ offset: timedelta = ...,
145
+ ) -> None: ...
146
+
147
+ class WeekOfMonthMixin(SingleConstructorOffset):
148
+ def __init__(
149
+ self, n: int = ..., normalize: bool = ..., weekday: int = ...
150
+ ) -> None: ...
151
+
152
+ class YearOffset(SingleConstructorOffset):
153
+ def __init__(
154
+ self, n: int = ..., normalize: bool = ..., month: int | None = ...
155
+ ) -> None: ...
156
+ @property
157
+ def month(self) -> int: ...
158
+
159
+ class BYearEnd(YearOffset): ...
160
+ class BYearBegin(YearOffset): ...
161
+
162
+ class YearEnd(YearOffset):
163
+ def __new__(
164
+ cls, n: int = ..., normalize: bool = ..., month: int | None = ...
165
+ ) -> Self: ...
166
+
167
+ class YearBegin(YearOffset): ...
168
+
169
+ class QuarterOffset(SingleConstructorOffset):
170
+ def __init__(
171
+ self, n: int = ..., normalize: bool = ..., startingMonth: int | None = ...
172
+ ) -> None: ...
173
+
174
+ class BQuarterEnd(QuarterOffset): ...
175
+ class BQuarterBegin(QuarterOffset): ...
176
+ class QuarterEnd(QuarterOffset): ...
177
+ class QuarterBegin(QuarterOffset): ...
178
+
179
+ class HalfYearOffset(SingleConstructorOffset):
180
+ def __init__(
181
+ self, n: int = ..., normalize: bool = ..., startingMonth: int | None = ...
182
+ ) -> None: ...
183
+
184
+ class BHalfYearEnd(HalfYearOffset): ...
185
+ class BHalfYearBegin(HalfYearOffset): ...
186
+ class HalfYearEnd(HalfYearOffset): ...
187
+ class HalfYearBegin(HalfYearOffset): ...
188
+ class MonthOffset(SingleConstructorOffset): ...
189
+ class MonthEnd(MonthOffset): ...
190
+ class MonthBegin(MonthOffset): ...
191
+ class BusinessMonthEnd(MonthOffset): ...
192
+ class BusinessMonthBegin(MonthOffset): ...
193
+
194
+ class SemiMonthOffset(SingleConstructorOffset):
195
+ def __init__(
196
+ self, n: int = ..., normalize: bool = ..., day_of_month: int | None = ...
197
+ ) -> None: ...
198
+
199
+ class SemiMonthEnd(SemiMonthOffset): ...
200
+ class SemiMonthBegin(SemiMonthOffset): ...
201
+
202
+ class Week(SingleConstructorOffset):
203
+ def __init__(
204
+ self, n: int = ..., normalize: bool = ..., weekday: int | None = ...
205
+ ) -> None: ...
206
+
207
+ class WeekOfMonth(WeekOfMonthMixin):
208
+ def __init__(
209
+ self, n: int = ..., normalize: bool = ..., week: int = ..., weekday: int = ...
210
+ ) -> None: ...
211
+
212
+ class LastWeekOfMonth(WeekOfMonthMixin):
213
+ def __init__(
214
+ self, n: int = ..., normalize: bool = ..., weekday: int = ...
215
+ ) -> None: ...
216
+
217
+ class FY5253Mixin(SingleConstructorOffset):
218
+ def __init__(
219
+ self,
220
+ n: int = ...,
221
+ normalize: bool = ...,
222
+ weekday: int = ...,
223
+ startingMonth: int = ...,
224
+ variation: Literal["nearest", "last"] = ...,
225
+ ) -> None: ...
226
+
227
+ class FY5253(FY5253Mixin): ...
228
+
229
+ class FY5253Quarter(FY5253Mixin):
230
+ def __init__(
231
+ self,
232
+ n: int = ...,
233
+ normalize: bool = ...,
234
+ weekday: int = ...,
235
+ startingMonth: int = ...,
236
+ qtr_with_extra_week: int = ...,
237
+ variation: Literal["nearest", "last"] = ...,
238
+ ) -> None: ...
239
+
240
+ class Easter(SingleConstructorOffset):
241
+ def __init__(
242
+ self,
243
+ n: int = ...,
244
+ normalize: bool = ...,
245
+ method: int = ...,
246
+ ) -> None: ...
247
+
248
+ class _CustomBusinessMonth(BusinessMixin):
249
+ def __init__(
250
+ self,
251
+ n: int = ...,
252
+ normalize: bool = ...,
253
+ weekmask: str = ...,
254
+ holidays: list | None = ...,
255
+ calendar: OffsetCalendar | None = ...,
256
+ offset: timedelta = ...,
257
+ ) -> None: ...
258
+
259
+ class CustomBusinessDay(BusinessDay):
260
+ def __init__(
261
+ self,
262
+ n: int = ...,
263
+ normalize: bool = ...,
264
+ weekmask: str = ...,
265
+ holidays: list | None = ...,
266
+ calendar: OffsetCalendar | None = ...,
267
+ offset: timedelta = ...,
268
+ ) -> None: ...
269
+
270
+ class CustomBusinessHour(BusinessHour):
271
+ def __init__(
272
+ self,
273
+ n: int = ...,
274
+ normalize: bool = ...,
275
+ weekmask: str = ...,
276
+ holidays: list | None = ...,
277
+ calendar: OffsetCalendar | None = ...,
278
+ start: str | time | Collection[str | time] = ...,
279
+ end: str | time | Collection[str | time] = ...,
280
+ offset: timedelta = ...,
281
+ ) -> None: ...
282
+
283
+ class CustomBusinessMonthEnd(_CustomBusinessMonth): ...
284
+ class CustomBusinessMonthBegin(_CustomBusinessMonth): ...
285
+ class OffsetMeta(type): ...
286
+ class DateOffset(RelativeDeltaOffset, metaclass=OffsetMeta): ...
287
+
288
+ BDay = BusinessDay
289
+ BMonthEnd = BusinessMonthEnd
290
+ BMonthBegin = BusinessMonthBegin
291
+ CBMonthEnd = CustomBusinessMonthEnd
292
+ CBMonthBegin = CustomBusinessMonthBegin
293
+ CDay = CustomBusinessDay
294
+
295
+ def roll_qtrday(
296
+ other: datetime, n: int, month: int, day_opt: str, modby: int
297
+ ) -> int: ...
298
+
299
+ INVALID_FREQ_ERR_MSG: Literal["Invalid frequency: {0}"]
300
+
301
+ def shift_months(
302
+ dtindex: npt.NDArray[np.int64],
303
+ months: int,
304
+ day_opt: str | None = ...,
305
+ reso: int = ...,
306
+ ) -> npt.NDArray[np.int64]: ...
307
+
308
+ _offset_map: dict[str, BaseOffset]
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/parsing.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9efbcf20870044abcf85481cfde27adfd6d24805c703211bbde38735a5cb19ff
3
+ size 334096
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/parsing.pyi ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import datetime
2
+
3
+ import numpy as np
4
+
5
+ from pandas._typing import npt
6
+
7
+ class DateParseError(ValueError): ...
8
+
9
+ def py_parse_datetime_string(
10
+ date_string: str,
11
+ dayfirst: bool = ...,
12
+ yearfirst: bool = ...,
13
+ ) -> datetime: ...
14
+ def parse_datetime_string_with_reso(
15
+ date_string: str,
16
+ freq: str | None = ...,
17
+ dayfirst: bool | None = ...,
18
+ yearfirst: bool | None = ...,
19
+ ) -> tuple[datetime, str]: ...
20
+ def _does_string_look_like_datetime(py_string: str) -> bool: ...
21
+ def quarter_to_myear(year: int, quarter: int, freq: str) -> tuple[int, int]: ...
22
+ def try_parse_dates(
23
+ values: npt.NDArray[np.object_], # object[:]
24
+ parser,
25
+ ) -> npt.NDArray[np.object_]: ...
26
+ def guess_datetime_format(
27
+ dt_str: str,
28
+ dayfirst: bool | None = ...,
29
+ ) -> str | None: ...
30
+ def get_rule_month(source: str) -> str: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/period.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:323d7b5fe1a02b912df75e019f1648e2a822e3cab46c40056d4d3891553708a4
3
+ size 468056
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/period.pyi ADDED
@@ -0,0 +1,135 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import timedelta
2
+ from typing import Literal
3
+
4
+ import numpy as np
5
+
6
+ from pandas._libs.tslibs.dtypes import PeriodDtypeBase
7
+ from pandas._libs.tslibs.nattype import NaTType
8
+ from pandas._libs.tslibs.offsets import BaseOffset
9
+ from pandas._libs.tslibs.timestamps import Timestamp
10
+ from pandas._typing import (
11
+ Frequency,
12
+ npt,
13
+ )
14
+
15
+ INVALID_FREQ_ERR_MSG: str
16
+ DIFFERENT_FREQ: str
17
+
18
+ class IncompatibleFrequency(TypeError): ...
19
+
20
+ def periodarr_to_dt64arr(
21
+ periodarr: npt.NDArray[np.int64], # const int64_t[:]
22
+ freq: int,
23
+ ) -> npt.NDArray[np.int64]: ...
24
+ def period_asfreq_arr(
25
+ arr: npt.NDArray[np.int64],
26
+ freq1: int,
27
+ freq2: int,
28
+ end: bool,
29
+ ) -> npt.NDArray[np.int64]: ...
30
+ def get_period_field_arr(
31
+ field: str,
32
+ arr: npt.NDArray[np.int64], # const int64_t[:]
33
+ freq: int,
34
+ ) -> npt.NDArray[np.int64]: ...
35
+ def from_ordinals(
36
+ values: npt.NDArray[np.int64], # const int64_t[:]
37
+ freq: timedelta | BaseOffset | str,
38
+ ) -> npt.NDArray[np.int64]: ...
39
+ def extract_ordinals(
40
+ values: npt.NDArray[np.object_],
41
+ freq: Frequency | int,
42
+ ) -> npt.NDArray[np.int64]: ...
43
+ def extract_freq(
44
+ values: npt.NDArray[np.object_],
45
+ ) -> BaseOffset: ...
46
+ def period_array_strftime(
47
+ values: npt.NDArray[np.int64],
48
+ dtype_code: int,
49
+ na_rep,
50
+ date_format: str | None,
51
+ ) -> npt.NDArray[np.object_]: ...
52
+
53
+ # exposed for tests
54
+ def period_asfreq(ordinal: int, freq1: int, freq2: int, end: bool) -> int: ...
55
+ def period_ordinal(
56
+ y: int, m: int, d: int, h: int, min: int, s: int, us: int, ps: int, freq: int
57
+ ) -> int: ...
58
+ def freq_to_dtype_code(freq: BaseOffset) -> int: ...
59
+ def validate_end_alias(how: str) -> Literal["E", "S"]: ...
60
+
61
+ class PeriodMixin:
62
+ @property
63
+ def end_time(self) -> Timestamp: ...
64
+ @property
65
+ def start_time(self) -> Timestamp: ...
66
+ def _require_matching_freq(self, other: BaseOffset, base: bool = ...) -> None: ...
67
+
68
+ class Period(PeriodMixin):
69
+ ordinal: int # int64_t
70
+ freq: BaseOffset
71
+ _dtype: PeriodDtypeBase
72
+
73
+ # error: "__new__" must return a class instance (got "Union[Period, NaTType]")
74
+ def __new__( # type: ignore[misc]
75
+ cls,
76
+ value=...,
77
+ freq: int | str | BaseOffset | None = ...,
78
+ ordinal: int | None = ...,
79
+ year: int | None = ...,
80
+ month: int | None = ...,
81
+ quarter: int | None = ...,
82
+ day: int | None = ...,
83
+ hour: int | None = ...,
84
+ minute: int | None = ...,
85
+ second: int | None = ...,
86
+ ) -> Period | NaTType: ...
87
+ @classmethod
88
+ def _maybe_convert_freq(cls, freq) -> BaseOffset: ...
89
+ @classmethod
90
+ def _from_ordinal(cls, ordinal: int, freq: BaseOffset) -> Period: ...
91
+ @classmethod
92
+ def now(cls, freq: Frequency) -> Period: ...
93
+ def strftime(self, fmt: str | None) -> str: ...
94
+ def to_timestamp(
95
+ self,
96
+ freq: str | BaseOffset | None = ...,
97
+ how: str = ...,
98
+ ) -> Timestamp: ...
99
+ def asfreq(self, freq: str | BaseOffset, how: str = ...) -> Period: ...
100
+ @property
101
+ def freqstr(self) -> str: ...
102
+ @property
103
+ def is_leap_year(self) -> bool: ...
104
+ @property
105
+ def daysinmonth(self) -> int: ...
106
+ @property
107
+ def days_in_month(self) -> int: ...
108
+ @property
109
+ def qyear(self) -> int: ...
110
+ @property
111
+ def quarter(self) -> int: ...
112
+ @property
113
+ def day_of_year(self) -> int: ...
114
+ @property
115
+ def weekday(self) -> int: ...
116
+ @property
117
+ def day_of_week(self) -> int: ...
118
+ @property
119
+ def week(self) -> int: ...
120
+ @property
121
+ def weekofyear(self) -> int: ...
122
+ @property
123
+ def second(self) -> int: ...
124
+ @property
125
+ def minute(self) -> int: ...
126
+ @property
127
+ def hour(self) -> int: ...
128
+ @property
129
+ def day(self) -> int: ...
130
+ @property
131
+ def month(self) -> int: ...
132
+ @property
133
+ def year(self) -> int: ...
134
+ def __sub__(self, other) -> Period | BaseOffset: ...
135
+ def __add__(self, other) -> Period: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/strptime.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3f5c8a1f11825192f39173d6e3d3188223c8a8ac034945f9da3dc66296cdd69f
3
+ size 334104
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/strptime.pyi ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import npt
4
+
5
+ def array_strptime(
6
+ values: npt.NDArray[np.object_],
7
+ fmt: str | None,
8
+ exact: bool = ...,
9
+ errors: str = ...,
10
+ utc: bool = ...,
11
+ creso: int = ..., # NPY_DATETIMEUNIT
12
+ ) -> tuple[np.ndarray, np.ndarray]: ...
13
+
14
+ # first ndarray is M8[ns], second is object ndarray of tzinfo | None
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timedeltas.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:28462dffeaa3d7718ada1ebc757ef9a95583ce12b32a9cc47e0314edbdfcd733
3
+ size 600288
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timedeltas.pyi ADDED
@@ -0,0 +1,168 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import timedelta
2
+ from typing import (
3
+ ClassVar,
4
+ Literal,
5
+ Self,
6
+ TypeAlias,
7
+ overload,
8
+ )
9
+
10
+ import numpy as np
11
+
12
+ from pandas._libs.tslibs import (
13
+ NaTType,
14
+ Tick,
15
+ )
16
+ from pandas._typing import (
17
+ Frequency,
18
+ TimeUnit,
19
+ npt,
20
+ )
21
+
22
+ # This should be kept consistent with the keys in the dict timedelta_abbrevs
23
+ # in pandas/_libs/tslibs/timedeltas.pyx
24
+ UnitChoices: TypeAlias = Literal[
25
+ "Y",
26
+ "y",
27
+ "M",
28
+ "W",
29
+ "w",
30
+ "D",
31
+ "d",
32
+ "days",
33
+ "day",
34
+ "hours",
35
+ "hour",
36
+ "hr",
37
+ "h",
38
+ "m",
39
+ "minute",
40
+ "min",
41
+ "minutes",
42
+ "s",
43
+ "seconds",
44
+ "sec",
45
+ "second",
46
+ "ms",
47
+ "milliseconds",
48
+ "millisecond",
49
+ "milli",
50
+ "millis",
51
+ "us",
52
+ "microseconds",
53
+ "microsecond",
54
+ "µs",
55
+ "micro",
56
+ "micros",
57
+ "ns",
58
+ "nanoseconds",
59
+ "nano",
60
+ "nanos",
61
+ "nanosecond",
62
+ ]
63
+
64
+ def get_unit_for_round(freq, creso: int) -> int: ...
65
+ def disallow_ambiguous_unit(unit: str | None) -> None: ...
66
+ def ints_to_pytimedelta(
67
+ m8values: npt.NDArray[np.timedelta64],
68
+ box: bool = ...,
69
+ ) -> npt.NDArray[np.object_]: ...
70
+ def array_to_timedelta64(
71
+ values: npt.NDArray[np.object_],
72
+ unit: str | None = ...,
73
+ errors: str = ...,
74
+ creso: int = ...,
75
+ ) -> np.ndarray: ... # np.ndarray[m8ns]
76
+ def parse_timedelta_unit(unit: str | None) -> UnitChoices: ...
77
+ def delta_to_nanoseconds(
78
+ delta: np.timedelta64 | timedelta | Tick,
79
+ reso: int = ..., # NPY_DATETIMEUNIT
80
+ round_ok: bool = ...,
81
+ ) -> int: ...
82
+ def floordiv_object_array(
83
+ left: np.ndarray, right: npt.NDArray[np.object_]
84
+ ) -> np.ndarray: ...
85
+ def truediv_object_array(
86
+ left: np.ndarray, right: npt.NDArray[np.object_]
87
+ ) -> np.ndarray: ...
88
+
89
+ class Timedelta(timedelta):
90
+ _creso: int
91
+ min: ClassVar[Timedelta]
92
+ max: ClassVar[Timedelta]
93
+ resolution: ClassVar[Timedelta]
94
+ value: int # np.int64
95
+ _value: int # np.int64
96
+ # error: "__new__" must return a class instance (got "Union[Timestamp, NaTType]")
97
+ def __new__( # type: ignore[misc]
98
+ cls: type[Self],
99
+ value=...,
100
+ unit: str | None = ...,
101
+ **kwargs: float | np.integer | np.floating,
102
+ ) -> Self | NaTType: ...
103
+ @classmethod
104
+ def _from_value_and_reso(cls, value: np.int64, reso: int) -> Timedelta: ...
105
+ @property
106
+ def days(self) -> int: ...
107
+ @property
108
+ def seconds(self) -> int: ...
109
+ @property
110
+ def microseconds(self) -> int: ...
111
+ def total_seconds(self) -> float: ...
112
+ def to_pytimedelta(self) -> timedelta: ...
113
+ def to_timedelta64(self) -> np.timedelta64: ...
114
+ @property
115
+ def asm8(self) -> np.timedelta64: ...
116
+ # TODO: round/floor/ceil could return NaT?
117
+ def round(self, freq: Frequency) -> Self: ...
118
+ def floor(self, freq: Frequency) -> Self: ...
119
+ def ceil(self, freq: Frequency) -> Self: ...
120
+ @property
121
+ def resolution_string(self) -> str: ...
122
+ def __add__(self, other: timedelta) -> Timedelta: ...
123
+ def __radd__(self, other: timedelta) -> Timedelta: ...
124
+ def __sub__(self, other: timedelta) -> Timedelta: ...
125
+ def __rsub__(self, other: timedelta) -> Timedelta: ...
126
+ def __neg__(self) -> Timedelta: ...
127
+ def __pos__(self) -> Timedelta: ...
128
+ def __abs__(self) -> Timedelta: ...
129
+ def __mul__(self, other: float) -> Timedelta: ...
130
+ def __rmul__(self, other: float) -> Timedelta: ...
131
+ # error: Signature of "__floordiv__" incompatible with supertype "timedelta"
132
+ @overload # type: ignore[override]
133
+ def __floordiv__(self, other: timedelta) -> int: ...
134
+ @overload
135
+ def __floordiv__(self, other: float) -> Timedelta: ...
136
+ @overload
137
+ def __floordiv__(
138
+ self, other: npt.NDArray[np.timedelta64]
139
+ ) -> npt.NDArray[np.intp]: ...
140
+ @overload
141
+ def __floordiv__(
142
+ self, other: npt.NDArray[np.number]
143
+ ) -> npt.NDArray[np.timedelta64] | Timedelta: ...
144
+ @overload
145
+ def __rfloordiv__(self, other: timedelta | str) -> int: ...
146
+ @overload
147
+ def __rfloordiv__(self, other: None | NaTType) -> NaTType: ...
148
+ @overload
149
+ def __rfloordiv__(self, other: np.ndarray) -> npt.NDArray[np.timedelta64]: ...
150
+ @overload
151
+ def __truediv__(self, other: timedelta) -> float: ...
152
+ @overload
153
+ def __truediv__(self, other: float) -> Timedelta: ...
154
+ def __mod__(self, other: timedelta) -> Timedelta: ...
155
+ def __divmod__(self, other: timedelta) -> tuple[int, Timedelta]: ...
156
+ def __le__(self, other: timedelta) -> bool: ...
157
+ def __lt__(self, other: timedelta) -> bool: ...
158
+ def __ge__(self, other: timedelta) -> bool: ...
159
+ def __gt__(self, other: timedelta) -> bool: ...
160
+ def __hash__(self) -> int: ...
161
+ def isoformat(self) -> str: ...
162
+ def to_numpy(
163
+ self, dtype: npt.DTypeLike | None = ..., copy: bool = False
164
+ ) -> np.timedelta64: ...
165
+ def view(self, dtype: npt.DTypeLike) -> object: ...
166
+ @property
167
+ def unit(self) -> TimeUnit: ...
168
+ def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Timedelta: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timestamps.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9ad9ebf354fbaf6eec7144937ae224c06e1b96a813293d32f8852c6db82e2862
3
+ size 536280
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timestamps.pyi ADDED
@@ -0,0 +1,242 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from datetime import (
2
+ date as _date,
3
+ datetime,
4
+ time as _time,
5
+ timedelta,
6
+ tzinfo as _tzinfo,
7
+ )
8
+ from time import struct_time
9
+ from typing import (
10
+ ClassVar,
11
+ Literal,
12
+ Self,
13
+ TypeAlias,
14
+ overload,
15
+ )
16
+
17
+ import numpy as np
18
+
19
+ from pandas._libs.tslibs import (
20
+ BaseOffset,
21
+ NaTType,
22
+ Period,
23
+ Tick,
24
+ Timedelta,
25
+ )
26
+ from pandas._typing import (
27
+ TimestampNonexistent,
28
+ TimeUnit,
29
+ )
30
+
31
+ _TimeZones: TypeAlias = str | _tzinfo | None | int
32
+
33
+ def integer_op_not_supported(obj: object) -> TypeError: ...
34
+
35
+ class Timestamp(datetime):
36
+ _creso: int
37
+ min: ClassVar[Timestamp]
38
+ max: ClassVar[Timestamp]
39
+
40
+ resolution: ClassVar[Timedelta]
41
+ _value: int # np.int64
42
+ # error: "__new__" must return a class instance (got "Union[Timestamp, NaTType]")
43
+ def __new__( # type: ignore[misc]
44
+ cls: type[Self],
45
+ ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ...,
46
+ year: int | None = ...,
47
+ month: int | None = ...,
48
+ day: int | None = ...,
49
+ hour: int | None = ...,
50
+ minute: int | None = ...,
51
+ second: int | None = ...,
52
+ microsecond: int | None = ...,
53
+ tzinfo: _tzinfo | None = ...,
54
+ *,
55
+ nanosecond: int | None = ...,
56
+ tz: _TimeZones = ...,
57
+ unit: str | int | None = ...,
58
+ fold: int | None = ...,
59
+ ) -> Self | NaTType: ...
60
+ @classmethod
61
+ def _from_value_and_reso(
62
+ cls, value: int, reso: int, tz: _TimeZones
63
+ ) -> Timestamp: ...
64
+ @property
65
+ def value(self) -> int: ... # np.int64
66
+ @property
67
+ def year(self) -> int: ...
68
+ @property
69
+ def month(self) -> int: ...
70
+ @property
71
+ def day(self) -> int: ...
72
+ @property
73
+ def hour(self) -> int: ...
74
+ @property
75
+ def minute(self) -> int: ...
76
+ @property
77
+ def second(self) -> int: ...
78
+ @property
79
+ def microsecond(self) -> int: ...
80
+ @property
81
+ def nanosecond(self) -> int: ...
82
+ @property
83
+ def tzinfo(self) -> _tzinfo | None: ...
84
+ @property
85
+ def tz(self) -> _tzinfo | None: ...
86
+ @property
87
+ def fold(self) -> int: ...
88
+ @classmethod
89
+ def fromtimestamp(cls, ts: float, tz: _TimeZones = ...) -> Self: ...
90
+ @classmethod
91
+ def utcfromtimestamp(cls, ts: float) -> Self: ...
92
+ @classmethod
93
+ def today(cls, tz: _TimeZones = ...) -> Self: ...
94
+ @classmethod
95
+ def fromordinal(
96
+ cls,
97
+ ordinal: int,
98
+ tz: _TimeZones = ...,
99
+ ) -> Self: ...
100
+ @classmethod
101
+ def now(cls, tz: _TimeZones = ...) -> Self: ...
102
+ @classmethod
103
+ def utcnow(cls) -> Self: ...
104
+ # error: Signature of "combine" incompatible with supertype "datetime"
105
+ @classmethod
106
+ def combine( # type: ignore[override]
107
+ cls, date: _date, time: _time
108
+ ) -> datetime: ...
109
+ @classmethod
110
+ def fromisoformat(cls, date_string: str, /) -> Self: ...
111
+ def strftime(self, format: str) -> str: ...
112
+ def __format__(self, fmt: str) -> str: ...
113
+ def toordinal(self) -> int: ...
114
+ def timetuple(self) -> struct_time: ...
115
+ def timestamp(self) -> float: ...
116
+ def utctimetuple(self) -> struct_time: ...
117
+ def date(self) -> _date: ...
118
+ def time(self) -> _time: ...
119
+ def timetz(self) -> _time: ...
120
+ # LSP violation: nanosecond is not present in datetime.datetime.replace
121
+ # and has positional args following it
122
+ def replace( # type: ignore[override]
123
+ self,
124
+ year: int | None = ...,
125
+ month: int | None = ...,
126
+ day: int | None = ...,
127
+ hour: int | None = ...,
128
+ minute: int | None = ...,
129
+ second: int | None = ...,
130
+ microsecond: int | None = ...,
131
+ nanosecond: int | None = ...,
132
+ tzinfo: _tzinfo | type[object] | None = ...,
133
+ fold: int | None = ...,
134
+ ) -> Self: ...
135
+ # LSP violation: datetime.datetime.astimezone has a default value for tz
136
+ def astimezone(self, tz: _TimeZones) -> Self: ... # type: ignore[override]
137
+ def ctime(self) -> str: ...
138
+ def isoformat(self, sep: str = ..., timespec: str = ...) -> str: ...
139
+ @classmethod
140
+ def strptime(
141
+ # Note: strptime is actually disabled and raises NotImplementedError
142
+ cls,
143
+ date_string: str,
144
+ format: str,
145
+ ) -> Self: ...
146
+ def utcoffset(self) -> timedelta | None: ...
147
+ def tzname(self) -> str | None: ...
148
+ def dst(self) -> timedelta | None: ...
149
+ def __le__(self, other: datetime) -> bool: ... # type: ignore[override]
150
+ def __lt__(self, other: datetime) -> bool: ... # type: ignore[override]
151
+ def __ge__(self, other: datetime) -> bool: ... # type: ignore[override]
152
+ def __gt__(self, other: datetime) -> bool: ... # type: ignore[override]
153
+ # error: Signature of "__add__" incompatible with supertype "date"/"datetime"
154
+ @overload # type: ignore[override]
155
+ def __add__(self, other: np.ndarray) -> np.ndarray: ...
156
+ @overload
157
+ def __add__(self, other: timedelta | np.timedelta64 | Tick) -> Self: ...
158
+ def __radd__(self, other: timedelta) -> Self: ...
159
+ @overload # type: ignore[override]
160
+ def __sub__(self, other: datetime) -> Timedelta: ...
161
+ @overload
162
+ def __sub__(self, other: timedelta | np.timedelta64 | Tick) -> Self: ...
163
+ def __hash__(self) -> int: ...
164
+ def weekday(self) -> int: ...
165
+ def isoweekday(self) -> int: ...
166
+ # Return type "Tuple[int, int, int]" of "isocalendar" incompatible with return
167
+ # type "_IsoCalendarDate" in supertype "date"
168
+ def isocalendar(self) -> tuple[int, int, int]: ... # type: ignore[override]
169
+ @property
170
+ def is_leap_year(self) -> bool: ...
171
+ @property
172
+ def is_month_start(self) -> bool: ...
173
+ @property
174
+ def is_quarter_start(self) -> bool: ...
175
+ @property
176
+ def is_year_start(self) -> bool: ...
177
+ @property
178
+ def is_month_end(self) -> bool: ...
179
+ @property
180
+ def is_quarter_end(self) -> bool: ...
181
+ @property
182
+ def is_year_end(self) -> bool: ...
183
+ def to_pydatetime(self, warn: bool = ...) -> datetime: ...
184
+ def to_datetime64(self) -> np.datetime64: ...
185
+ def to_period(self, freq: BaseOffset | str | None = None) -> Period: ...
186
+ def to_julian_date(self) -> np.float64: ...
187
+ @property
188
+ def asm8(self) -> np.datetime64: ...
189
+ def tz_convert(self, tz: _TimeZones) -> Self: ...
190
+ # TODO: could return NaT?
191
+ def tz_localize(
192
+ self,
193
+ tz: _TimeZones,
194
+ ambiguous: bool | Literal["raise", "NaT"] = ...,
195
+ nonexistent: TimestampNonexistent = ...,
196
+ ) -> Self: ...
197
+ def normalize(self) -> Self: ...
198
+ # TODO: round/floor/ceil could return NaT?
199
+ def round(
200
+ self,
201
+ freq: str,
202
+ ambiguous: bool | Literal["raise", "NaT"] = ...,
203
+ nonexistent: TimestampNonexistent = ...,
204
+ ) -> Self: ...
205
+ def floor(
206
+ self,
207
+ freq: str,
208
+ ambiguous: bool | Literal["raise", "NaT"] = ...,
209
+ nonexistent: TimestampNonexistent = ...,
210
+ ) -> Self: ...
211
+ def ceil(
212
+ self,
213
+ freq: str,
214
+ ambiguous: bool | Literal["raise", "NaT"] = ...,
215
+ nonexistent: TimestampNonexistent = ...,
216
+ ) -> Self: ...
217
+ def day_name(self, locale: str | None = ...) -> str: ...
218
+ def month_name(self, locale: str | None = ...) -> str: ...
219
+ @property
220
+ def day_of_week(self) -> int: ...
221
+ @property
222
+ def dayofweek(self) -> int: ...
223
+ @property
224
+ def day_of_year(self) -> int: ...
225
+ @property
226
+ def dayofyear(self) -> int: ...
227
+ @property
228
+ def quarter(self) -> int: ...
229
+ @property
230
+ def week(self) -> int: ...
231
+ def to_numpy(
232
+ self, dtype: np.dtype | None = ..., copy: bool = ...
233
+ ) -> np.datetime64: ...
234
+ @property
235
+ def _date_repr(self) -> str: ...
236
+ @property
237
+ def days_in_month(self) -> int: ...
238
+ @property
239
+ def daysinmonth(self) -> int: ...
240
+ @property
241
+ def unit(self) -> TimeUnit: ...
242
+ def as_unit(self, unit: TimeUnit, round_ok: bool = ...) -> Timestamp: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timezones.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:66827f16cdc673673579533ce0eb3fc999d1b1a35faab718177013fe64244a9e
3
+ size 267872
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/timezones.pyi ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable
2
+ from datetime import (
3
+ datetime,
4
+ tzinfo,
5
+ )
6
+
7
+ import numpy as np
8
+
9
+ # imported from dateutil.tz
10
+ dateutil_gettz: Callable[[str], tzinfo]
11
+
12
+ def tz_standardize(tz: tzinfo) -> tzinfo: ...
13
+ def tz_compare(start: tzinfo | None, end: tzinfo | None) -> bool: ...
14
+ def infer_tzinfo(
15
+ start: datetime | None,
16
+ end: datetime | None,
17
+ ) -> tzinfo | None: ...
18
+ def maybe_get_tz(tz: str | int | np.int64 | tzinfo | None) -> tzinfo | None: ...
19
+ def get_timezone(tz: tzinfo) -> tzinfo | str: ...
20
+ def is_utc(tz: tzinfo | None) -> bool: ...
21
+ def is_fixed_offset(tz: tzinfo) -> bool: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/tzconversion.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a530b984c8998a9ee4dc93e0e736d40cb858af4988fd222e4dfe635975061a3f
3
+ size 268456
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/tzconversion.pyi ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Iterable
2
+ from datetime import (
3
+ timedelta,
4
+ tzinfo,
5
+ )
6
+
7
+ import numpy as np
8
+
9
+ from pandas._typing import npt
10
+
11
+ # tz_convert_from_utc_single exposed for testing
12
+ def tz_convert_from_utc_single(
13
+ utc_val: np.int64, tz: tzinfo, creso: int = ...
14
+ ) -> np.int64: ...
15
+ def tz_localize_to_utc(
16
+ vals: npt.NDArray[np.int64],
17
+ tz: tzinfo | None,
18
+ ambiguous: str | bool | Iterable[bool] | None = ...,
19
+ nonexistent: str | timedelta | np.timedelta64 | None = ...,
20
+ creso: int = ..., # NPY_DATETIMEUNIT
21
+ ) -> npt.NDArray[np.int64]: ...
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/vectorized.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fdb231e9948b5da059399c6f92cc3ee1754ff5fdeae7dc9e8edaf292eb05d33b
3
+ size 202296
.venv/lib/python3.11/site-packages/pandas/_libs/tslibs/vectorized.pyi ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # For cython types that cannot be represented precisely, closest-available
2
+ # python equivalents are used, and the precise types kept as adjacent comments.
3
+ from datetime import tzinfo
4
+
5
+ import numpy as np
6
+
7
+ from pandas._libs.tslibs.dtypes import Resolution
8
+ from pandas._typing import npt
9
+
10
+ def dt64arr_to_periodarr(
11
+ stamps: npt.NDArray[np.int64],
12
+ freq: int,
13
+ tz: tzinfo | None,
14
+ reso: int = ..., # NPY_DATETIMEUNIT
15
+ ) -> npt.NDArray[np.int64]: ...
16
+ def is_date_array_normalized(
17
+ stamps: npt.NDArray[np.int64],
18
+ tz: tzinfo | None,
19
+ reso: int, # NPY_DATETIMEUNIT
20
+ ) -> bool: ...
21
+ def normalize_i8_timestamps(
22
+ stamps: npt.NDArray[np.int64],
23
+ tz: tzinfo | None,
24
+ reso: int, # NPY_DATETIMEUNIT
25
+ ) -> npt.NDArray[np.int64]: ...
26
+ def get_resolution(
27
+ stamps: npt.NDArray[np.int64],
28
+ tz: tzinfo | None = ...,
29
+ reso: int = ..., # NPY_DATETIMEUNIT
30
+ ) -> Resolution: ...
31
+ def ints_to_pydatetime(
32
+ stamps: npt.NDArray[np.int64],
33
+ tz: tzinfo | None = ...,
34
+ box: str = ...,
35
+ reso: int = ..., # NPY_DATETIMEUNIT
36
+ ) -> npt.NDArray[np.object_]: ...
37
+ def tz_convert_from_utc(
38
+ stamps: npt.NDArray[np.int64],
39
+ tz: tzinfo | None,
40
+ reso: int = ..., # NPY_DATETIMEUNIT
41
+ ) -> npt.NDArray[np.int64]: ...
.venv/lib/python3.11/site-packages/pandas/_libs/window/__init__.py ADDED
File without changes
.venv/lib/python3.11/site-packages/pandas/_libs/window/aggregations.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5a6f240433ddd352874c4b3a3f72bada993026e952c756425fc0b2a12048f070
3
+ size 468512
.venv/lib/python3.11/site-packages/pandas/_libs/window/aggregations.pyi ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from collections.abc import Callable
2
+ from typing import (
3
+ Any,
4
+ Literal,
5
+ )
6
+
7
+ import numpy as np
8
+
9
+ from pandas._typing import (
10
+ WindowingRankType,
11
+ npt,
12
+ )
13
+
14
+ def roll_sum(
15
+ values: np.ndarray, # const float64_t[:]
16
+ start: np.ndarray, # np.ndarray[np.int64]
17
+ end: np.ndarray, # np.ndarray[np.int64]
18
+ minp: int, # int64_t
19
+ ) -> np.ndarray: ... # np.ndarray[float]
20
+ def roll_mean(
21
+ values: np.ndarray, # const float64_t[:]
22
+ start: np.ndarray, # np.ndarray[np.int64]
23
+ end: np.ndarray, # np.ndarray[np.int64]
24
+ minp: int, # int64_t
25
+ ) -> np.ndarray: ... # np.ndarray[float]
26
+ def roll_var(
27
+ values: np.ndarray, # const float64_t[:]
28
+ start: np.ndarray, # np.ndarray[np.int64]
29
+ end: np.ndarray, # np.ndarray[np.int64]
30
+ minp: int, # int64_t
31
+ ddof: int = ...,
32
+ ) -> np.ndarray: ... # np.ndarray[float]
33
+ def roll_skew(
34
+ values: np.ndarray, # np.ndarray[np.float64]
35
+ start: np.ndarray, # np.ndarray[np.int64]
36
+ end: np.ndarray, # np.ndarray[np.int64]
37
+ minp: int, # int64_t
38
+ ) -> np.ndarray: ... # np.ndarray[float]
39
+ def roll_kurt(
40
+ values: np.ndarray, # np.ndarray[np.float64]
41
+ start: np.ndarray, # np.ndarray[np.int64]
42
+ end: np.ndarray, # np.ndarray[np.int64]
43
+ minp: int, # int64_t
44
+ ) -> np.ndarray: ... # np.ndarray[float]
45
+ def roll_median_c(
46
+ values: np.ndarray, # np.ndarray[np.float64]
47
+ start: np.ndarray, # np.ndarray[np.int64]
48
+ end: np.ndarray, # np.ndarray[np.int64]
49
+ minp: int, # int64_t
50
+ ) -> np.ndarray: ... # np.ndarray[float]
51
+ def roll_max(
52
+ values: np.ndarray, # np.ndarray[np.float64]
53
+ start: np.ndarray, # np.ndarray[np.int64]
54
+ end: np.ndarray, # np.ndarray[np.int64]
55
+ minp: int, # int64_t
56
+ ) -> np.ndarray: ... # np.ndarray[float]
57
+ def roll_min(
58
+ values: np.ndarray, # np.ndarray[np.float64]
59
+ start: np.ndarray, # np.ndarray[np.int64]
60
+ end: np.ndarray, # np.ndarray[np.int64]
61
+ minp: int, # int64_t
62
+ ) -> np.ndarray: ... # np.ndarray[float]
63
+ def roll_first(
64
+ values: np.ndarray, # np.ndarray[np.float64]
65
+ start: np.ndarray, # np.ndarray[np.int64]
66
+ end: np.ndarray, # np.ndarray[np.int64]
67
+ minp: int, # int64_t
68
+ ) -> np.ndarray: ... # np.ndarray[float]
69
+ def roll_last(
70
+ values: np.ndarray, # np.ndarray[np.float64]
71
+ start: np.ndarray, # np.ndarray[np.int64]
72
+ end: np.ndarray, # np.ndarray[np.int64]
73
+ minp: int, # int64_t
74
+ ) -> np.ndarray: ... # np.ndarray[float]
75
+ def roll_quantile(
76
+ values: np.ndarray, # const float64_t[:]
77
+ start: np.ndarray, # np.ndarray[np.int64]
78
+ end: np.ndarray, # np.ndarray[np.int64]
79
+ minp: int, # int64_t
80
+ quantile: float, # float64_t
81
+ interpolation: Literal["linear", "lower", "higher", "nearest", "midpoint"],
82
+ ) -> np.ndarray: ... # np.ndarray[float]
83
+ def roll_rank(
84
+ values: np.ndarray,
85
+ start: np.ndarray,
86
+ end: np.ndarray,
87
+ minp: int,
88
+ percentile: bool,
89
+ method: WindowingRankType,
90
+ ascending: bool,
91
+ ) -> np.ndarray: ... # np.ndarray[float]
92
+ def roll_nunique(
93
+ values: np.ndarray, # const float64_t[:]
94
+ start: np.ndarray, # np.ndarray[np.int64]
95
+ end: np.ndarray, # np.ndarray[np.int64]
96
+ minp: int, # int64_t
97
+ ) -> np.ndarray: ... # np.ndarray[float]
98
+ def roll_apply(
99
+ obj: object,
100
+ start: np.ndarray, # np.ndarray[np.int64]
101
+ end: np.ndarray, # np.ndarray[np.int64]
102
+ minp: int, # int64_t
103
+ function: Callable[..., Any],
104
+ raw: bool,
105
+ args: tuple[Any, ...],
106
+ kwargs: dict[str, Any],
107
+ ) -> npt.NDArray[np.float64]: ...
108
+ def roll_weighted_sum(
109
+ values: np.ndarray, # const float64_t[:]
110
+ weights: np.ndarray, # const float64_t[:]
111
+ minp: int,
112
+ ) -> np.ndarray: ... # np.ndarray[np.float64]
113
+ def roll_weighted_mean(
114
+ values: np.ndarray, # const float64_t[:]
115
+ weights: np.ndarray, # const float64_t[:]
116
+ minp: int,
117
+ ) -> np.ndarray: ... # np.ndarray[np.float64]
118
+ def roll_weighted_var(
119
+ values: np.ndarray, # const float64_t[:]
120
+ weights: np.ndarray, # const float64_t[:]
121
+ minp: int, # int64_t
122
+ ddof: int, # unsigned int
123
+ ) -> np.ndarray: ... # np.ndarray[np.float64]
124
+ def ewm(
125
+ vals: np.ndarray, # const float64_t[:]
126
+ start: np.ndarray, # const int64_t[:]
127
+ end: np.ndarray, # const int64_t[:]
128
+ minp: int,
129
+ com: float, # float64_t
130
+ adjust: bool,
131
+ ignore_na: bool,
132
+ deltas: np.ndarray | None = None, # const float64_t[:]
133
+ normalize: bool = True,
134
+ ) -> np.ndarray: ... # np.ndarray[np.float64]
135
+ def ewmcov(
136
+ input_x: np.ndarray, # const float64_t[:]
137
+ start: np.ndarray, # const int64_t[:]
138
+ end: np.ndarray, # const int64_t[:]
139
+ minp: int,
140
+ input_y: np.ndarray, # const float64_t[:]
141
+ com: float, # float64_t
142
+ adjust: bool,
143
+ ignore_na: bool,
144
+ bias: bool,
145
+ ) -> np.ndarray: ... # np.ndarray[np.float64]
.venv/lib/python3.11/site-packages/pandas/_libs/window/indexers.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ed64d154ae9a2e7502d304297c0270de01050058ece64755ecd5f652b5fec8a6
3
+ size 269560
.venv/lib/python3.11/site-packages/pandas/_libs/window/indexers.pyi ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import npt
4
+
5
+ def calculate_variable_window_bounds(
6
+ num_values: int, # int64_t
7
+ window_size: int, # int64_t
8
+ min_periods,
9
+ center: bool,
10
+ closed: str | None,
11
+ index: np.ndarray, # const int64_t[:]
12
+ ) -> tuple[npt.NDArray[np.int64], npt.NDArray[np.int64]]: ...
.venv/lib/python3.11/site-packages/pandas/_libs/writers.cpython-311-aarch64-linux-gnu.so ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4acd324965bc1280aab2dce4df2a804e6f2886982c43a952d1c4862d5473510a
3
+ size 202848
.venv/lib/python3.11/site-packages/pandas/_libs/writers.pyi ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import ArrayLike
4
+
5
+ def write_csv_rows(
6
+ data: list[ArrayLike],
7
+ data_index: np.ndarray,
8
+ nlevels: int,
9
+ cols: np.ndarray,
10
+ writer: object, # _csv.writer
11
+ ) -> None: ...
12
+ def convert_json_to_lines(arr: str) -> str: ...
13
+ def max_len_string_array(
14
+ arr: np.ndarray, # pandas_string[:]
15
+ ) -> int: ...
16
+ def word_len(val: object) -> int: ...
17
+ def string_array_replace_from_nan_rep(
18
+ arr: np.ndarray, # np.ndarray[object, ndim=1]
19
+ nan_rep: object,
20
+ ) -> None: ...
.venv/lib/python3.11/site-packages/pandas/_testing/__init__.py ADDED
@@ -0,0 +1,645 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from concurrent.futures import ThreadPoolExecutor
4
+ from decimal import Decimal
5
+ import operator
6
+ import os
7
+ from sys import byteorder
8
+ import threading
9
+ from typing import (
10
+ TYPE_CHECKING,
11
+ ContextManager,
12
+ )
13
+
14
+ import numpy as np
15
+
16
+ from pandas._config import using_string_dtype
17
+ from pandas._config.localization import (
18
+ can_set_locale,
19
+ get_locales,
20
+ set_locale,
21
+ )
22
+
23
+ from pandas.compat import HAS_PYARROW
24
+
25
+ import pandas as pd
26
+ from pandas import (
27
+ ArrowDtype,
28
+ DataFrame,
29
+ Index,
30
+ MultiIndex,
31
+ RangeIndex,
32
+ Series,
33
+ )
34
+ from pandas._testing._io import (
35
+ round_trip_pathlib,
36
+ round_trip_pickle,
37
+ write_to_compressed,
38
+ )
39
+ from pandas._testing._warnings import (
40
+ assert_produces_warning,
41
+ maybe_produces_warning,
42
+ )
43
+ from pandas._testing.asserters import (
44
+ assert_almost_equal,
45
+ assert_attr_equal,
46
+ assert_categorical_equal,
47
+ assert_class_equal,
48
+ assert_contains_all,
49
+ assert_copy,
50
+ assert_datetime_array_equal,
51
+ assert_dict_equal,
52
+ assert_equal,
53
+ assert_extension_array_equal,
54
+ assert_frame_equal,
55
+ assert_index_equal,
56
+ assert_indexing_slices_equivalent,
57
+ assert_interval_array_equal,
58
+ assert_is_sorted,
59
+ assert_metadata_equivalent,
60
+ assert_numpy_array_equal,
61
+ assert_period_array_equal,
62
+ assert_series_equal,
63
+ assert_sp_array_equal,
64
+ assert_timedelta_array_equal,
65
+ raise_assert_detail,
66
+ )
67
+ from pandas._testing.compat import (
68
+ get_dtype,
69
+ get_obj,
70
+ )
71
+ from pandas._testing.contexts import (
72
+ decompress_file,
73
+ raises_chained_assignment_error,
74
+ set_timezone,
75
+ with_csv_dialect,
76
+ )
77
+ from pandas.core.arrays import (
78
+ ArrowExtensionArray,
79
+ BaseMaskedArray,
80
+ NumpyExtensionArray,
81
+ )
82
+ from pandas.core.arrays._mixins import NDArrayBackedExtensionArray
83
+ from pandas.core.construction import extract_array
84
+
85
+ if TYPE_CHECKING:
86
+ from collections.abc import Callable
87
+
88
+ from pandas._typing import (
89
+ Dtype,
90
+ NpDtype,
91
+ )
92
+
93
+
94
+ UNSIGNED_INT_NUMPY_DTYPES: list[NpDtype] = ["uint8", "uint16", "uint32", "uint64"]
95
+ UNSIGNED_INT_EA_DTYPES: list[Dtype] = ["UInt8", "UInt16", "UInt32", "UInt64"]
96
+ SIGNED_INT_NUMPY_DTYPES: list[NpDtype] = [int, "int8", "int16", "int32", "int64"]
97
+ SIGNED_INT_EA_DTYPES: list[Dtype] = ["Int8", "Int16", "Int32", "Int64"]
98
+ ALL_INT_NUMPY_DTYPES = UNSIGNED_INT_NUMPY_DTYPES + SIGNED_INT_NUMPY_DTYPES
99
+ ALL_INT_EA_DTYPES = UNSIGNED_INT_EA_DTYPES + SIGNED_INT_EA_DTYPES
100
+ ALL_INT_DTYPES: list[Dtype] = [*ALL_INT_NUMPY_DTYPES, *ALL_INT_EA_DTYPES]
101
+
102
+ FLOAT_NUMPY_DTYPES: list[NpDtype] = [float, "float32", "float64"]
103
+ FLOAT_EA_DTYPES: list[Dtype] = ["Float32", "Float64"]
104
+ ALL_FLOAT_DTYPES: list[Dtype] = [*FLOAT_NUMPY_DTYPES, *FLOAT_EA_DTYPES]
105
+
106
+ COMPLEX_DTYPES: list[Dtype] = [complex, "complex64", "complex128"]
107
+ if using_string_dtype():
108
+ STRING_DTYPES: list[Dtype] = ["U"]
109
+ else:
110
+ STRING_DTYPES: list[Dtype] = [str, "str", "U"] # type: ignore[no-redef]
111
+ COMPLEX_FLOAT_DTYPES: list[Dtype] = [*COMPLEX_DTYPES, *FLOAT_NUMPY_DTYPES]
112
+
113
+ DATETIME64_DTYPES: list[Dtype] = ["datetime64[ns]", "M8[ns]"]
114
+ TIMEDELTA64_DTYPES: list[Dtype] = ["timedelta64[ns]", "m8[ns]"]
115
+
116
+ BOOL_DTYPES: list[Dtype] = [bool, "bool"]
117
+ BYTES_DTYPES: list[Dtype] = [bytes, "bytes"]
118
+ OBJECT_DTYPES: list[Dtype] = [object, "object"]
119
+
120
+ ALL_REAL_NUMPY_DTYPES = FLOAT_NUMPY_DTYPES + ALL_INT_NUMPY_DTYPES
121
+ ALL_REAL_EXTENSION_DTYPES = FLOAT_EA_DTYPES + ALL_INT_EA_DTYPES
122
+ ALL_REAL_DTYPES: list[Dtype] = [*ALL_REAL_NUMPY_DTYPES, *ALL_REAL_EXTENSION_DTYPES]
123
+ ALL_NUMERIC_DTYPES: list[Dtype] = [*ALL_REAL_DTYPES, *COMPLEX_DTYPES]
124
+
125
+ ALL_NUMPY_DTYPES = (
126
+ ALL_REAL_NUMPY_DTYPES
127
+ + COMPLEX_DTYPES
128
+ + STRING_DTYPES
129
+ + DATETIME64_DTYPES
130
+ + TIMEDELTA64_DTYPES
131
+ + BOOL_DTYPES
132
+ + OBJECT_DTYPES
133
+ + BYTES_DTYPES
134
+ )
135
+
136
+ NARROW_NP_DTYPES = [
137
+ np.float16,
138
+ np.float32,
139
+ np.int8,
140
+ np.int16,
141
+ np.int32,
142
+ np.uint8,
143
+ np.uint16,
144
+ np.uint32,
145
+ ]
146
+
147
+ PYTHON_DATA_TYPES = [
148
+ str,
149
+ int,
150
+ float,
151
+ complex,
152
+ list,
153
+ tuple,
154
+ range,
155
+ dict,
156
+ set,
157
+ frozenset,
158
+ bool,
159
+ bytes,
160
+ bytearray,
161
+ memoryview,
162
+ ]
163
+
164
+ ENDIAN = {"little": "<", "big": ">"}[byteorder]
165
+
166
+ NULL_OBJECTS = [None, np.nan, pd.NaT, float("nan"), pd.NA, Decimal("NaN")]
167
+ NP_NAT_OBJECTS = [
168
+ cls("NaT", unit)
169
+ for cls in [np.datetime64, np.timedelta64]
170
+ for unit in [
171
+ "Y",
172
+ "M",
173
+ "W",
174
+ "D",
175
+ "h",
176
+ "m",
177
+ "s",
178
+ "ms",
179
+ "us",
180
+ "ns",
181
+ "ps",
182
+ "fs",
183
+ "as",
184
+ ]
185
+ ]
186
+
187
+ if HAS_PYARROW:
188
+ import pyarrow as pa
189
+
190
+ UNSIGNED_INT_PYARROW_DTYPES = [pa.uint8(), pa.uint16(), pa.uint32(), pa.uint64()]
191
+ SIGNED_INT_PYARROW_DTYPES = [pa.int8(), pa.int16(), pa.int32(), pa.int64()]
192
+ ALL_INT_PYARROW_DTYPES = UNSIGNED_INT_PYARROW_DTYPES + SIGNED_INT_PYARROW_DTYPES
193
+ ALL_INT_PYARROW_DTYPES_STR_REPR = [
194
+ str(ArrowDtype(typ)) for typ in ALL_INT_PYARROW_DTYPES
195
+ ]
196
+
197
+ # pa.float16 doesn't seem supported
198
+ # https://github.com/apache/arrow/blob/master/python/pyarrow/src/arrow/python/helpers.cc#L86
199
+ FLOAT_PYARROW_DTYPES = [pa.float32(), pa.float64()]
200
+ FLOAT_PYARROW_DTYPES_STR_REPR = [
201
+ str(ArrowDtype(typ)) for typ in FLOAT_PYARROW_DTYPES
202
+ ]
203
+ DECIMAL_PYARROW_DTYPES = [pa.decimal128(7, 3)]
204
+ STRING_PYARROW_DTYPES = [pa.string()]
205
+ BINARY_PYARROW_DTYPES = [pa.binary()]
206
+
207
+ TIME_PYARROW_DTYPES = [
208
+ pa.time32("s"),
209
+ pa.time32("ms"),
210
+ pa.time64("us"),
211
+ pa.time64("ns"),
212
+ ]
213
+ DATE_PYARROW_DTYPES = [pa.date32(), pa.date64()]
214
+ DATETIME_PYARROW_DTYPES = [
215
+ pa.timestamp(unit=unit, tz=tz)
216
+ for unit in ["s", "ms", "us", "ns"]
217
+ for tz in [None, "UTC", "US/Pacific", "US/Eastern"]
218
+ ]
219
+ TIMEDELTA_PYARROW_DTYPES = [pa.duration(unit) for unit in ["s", "ms", "us", "ns"]]
220
+
221
+ BOOL_PYARROW_DTYPES = [pa.bool_()]
222
+
223
+ # TODO: Add container like pyarrow types:
224
+ # https://arrow.apache.org/docs/python/api/datatypes.html#factory-functions
225
+ ALL_PYARROW_DTYPES = (
226
+ ALL_INT_PYARROW_DTYPES
227
+ + FLOAT_PYARROW_DTYPES
228
+ + DECIMAL_PYARROW_DTYPES
229
+ + STRING_PYARROW_DTYPES
230
+ + BINARY_PYARROW_DTYPES
231
+ + TIME_PYARROW_DTYPES
232
+ + DATE_PYARROW_DTYPES
233
+ + DATETIME_PYARROW_DTYPES
234
+ + TIMEDELTA_PYARROW_DTYPES
235
+ + BOOL_PYARROW_DTYPES
236
+ )
237
+ ALL_REAL_PYARROW_DTYPES_STR_REPR = (
238
+ ALL_INT_PYARROW_DTYPES_STR_REPR + FLOAT_PYARROW_DTYPES_STR_REPR
239
+ )
240
+ else:
241
+ FLOAT_PYARROW_DTYPES_STR_REPR = []
242
+ ALL_INT_PYARROW_DTYPES_STR_REPR = []
243
+ ALL_PYARROW_DTYPES = []
244
+ ALL_REAL_PYARROW_DTYPES_STR_REPR = []
245
+
246
+ ALL_REAL_NULLABLE_DTYPES = (
247
+ FLOAT_NUMPY_DTYPES + ALL_REAL_EXTENSION_DTYPES + ALL_REAL_PYARROW_DTYPES_STR_REPR
248
+ )
249
+
250
+ arithmetic_dunder_methods = [
251
+ "__add__",
252
+ "__radd__",
253
+ "__sub__",
254
+ "__rsub__",
255
+ "__mul__",
256
+ "__rmul__",
257
+ "__floordiv__",
258
+ "__rfloordiv__",
259
+ "__truediv__",
260
+ "__rtruediv__",
261
+ "__pow__",
262
+ "__rpow__",
263
+ "__mod__",
264
+ "__rmod__",
265
+ ]
266
+
267
+ comparison_dunder_methods = ["__eq__", "__ne__", "__le__", "__lt__", "__ge__", "__gt__"]
268
+
269
+
270
+ # -----------------------------------------------------------------------------
271
+ # Comparators
272
+
273
+
274
+ def box_expected(expected, box_cls, transpose: bool = True):
275
+ """
276
+ Helper function to wrap the expected output of a test in a given box_class.
277
+
278
+ Parameters
279
+ ----------
280
+ expected : np.ndarray, Index, Series
281
+ box_cls : {Index, Series, DataFrame}
282
+
283
+ Returns
284
+ -------
285
+ subclass of box_cls
286
+ """
287
+ if box_cls is pd.array:
288
+ if isinstance(expected, RangeIndex):
289
+ # pd.array would return an IntegerArray
290
+ expected = NumpyExtensionArray(np.asarray(expected._values))
291
+ else:
292
+ expected = pd.array(expected, copy=False)
293
+ elif box_cls is Index:
294
+ expected = Index(expected, copy=False)
295
+ elif box_cls is Series:
296
+ expected = Series(expected)
297
+ elif box_cls is DataFrame:
298
+ expected = Series(expected).to_frame()
299
+ if transpose:
300
+ # for vector operations, we need a DataFrame to be a single-row,
301
+ # not a single-column, in order to operate against non-DataFrame
302
+ # vectors of the same length. But convert to two rows to avoid
303
+ # single-row special cases in datetime arithmetic
304
+ expected = expected.T
305
+ expected = pd.concat([expected] * 2, ignore_index=True)
306
+ elif box_cls is np.ndarray or box_cls is np.array:
307
+ expected = np.array(expected)
308
+ elif box_cls is to_array:
309
+ expected = to_array(expected)
310
+ else:
311
+ raise NotImplementedError(box_cls)
312
+ return expected
313
+
314
+
315
+ def to_array(obj):
316
+ """
317
+ Similar to pd.array, but does not cast numpy dtypes to nullable dtypes.
318
+ """
319
+ # temporary implementation until we get pd.array in place
320
+ dtype = getattr(obj, "dtype", None)
321
+
322
+ if dtype is None:
323
+ return np.asarray(obj)
324
+
325
+ return extract_array(obj, extract_numpy=True)
326
+
327
+
328
+ class SubclassedSeries(Series):
329
+ _metadata = ["testattr", "name"]
330
+
331
+ @property
332
+ def _constructor(self):
333
+ # For testing, those properties return a generic callable, and not
334
+ # the actual class. In this case that is equivalent, but it is to
335
+ # ensure we don't rely on the property returning a class
336
+ # See https://github.com/pandas-dev/pandas/pull/46018 and
337
+ # https://github.com/pandas-dev/pandas/issues/32638 and linked issues
338
+ return lambda *args, **kwargs: SubclassedSeries(*args, **kwargs)
339
+
340
+ @property
341
+ def _constructor_expanddim(self):
342
+ return lambda *args, **kwargs: SubclassedDataFrame(*args, **kwargs)
343
+
344
+
345
+ class SubclassedDataFrame(DataFrame):
346
+ _metadata = ["testattr"]
347
+
348
+ @property
349
+ def _constructor(self):
350
+ return lambda *args, **kwargs: SubclassedDataFrame(*args, **kwargs)
351
+
352
+ # error: Cannot override writeable attribute with read-only property
353
+ @property
354
+ def _constructor_sliced(self): # type: ignore[override]
355
+ return lambda *args, **kwargs: SubclassedSeries(*args, **kwargs)
356
+
357
+
358
+ def convert_rows_list_to_csv_str(rows_list: list[str]) -> str:
359
+ """
360
+ Convert list of CSV rows to single CSV-formatted string for current OS.
361
+
362
+ This method is used for creating expected value of to_csv() method.
363
+
364
+ Parameters
365
+ ----------
366
+ rows_list : List[str]
367
+ Each element represents the row of csv.
368
+
369
+ Returns
370
+ -------
371
+ str
372
+ Expected output of to_csv() in current OS.
373
+ """
374
+ sep = os.linesep
375
+ return sep.join(rows_list) + sep
376
+
377
+
378
+ def external_error_raised(expected_exception: type[Exception]) -> ContextManager:
379
+ """
380
+ Helper function to mark pytest.raises that have an external error message.
381
+
382
+ Parameters
383
+ ----------
384
+ expected_exception : Exception
385
+ Expected error to raise.
386
+
387
+ Returns
388
+ -------
389
+ Callable
390
+ Regular `pytest.raises` function with `match` equal to `None`.
391
+ """
392
+ import pytest
393
+
394
+ return pytest.raises(expected_exception, match=None)
395
+
396
+
397
+ def get_cython_table_params(ndframe, func_names_and_expected):
398
+ """
399
+ Combine frame, functions from com._cython_table
400
+ keys and expected result.
401
+
402
+ Parameters
403
+ ----------
404
+ ndframe : DataFrame or Series
405
+ func_names_and_expected : Sequence of two items
406
+ The first item is a name of an NDFrame method ('sum', 'prod') etc.
407
+ The second item is the expected return value.
408
+
409
+ Returns
410
+ -------
411
+ list
412
+ List of three items (DataFrame, function, expected result)
413
+ """
414
+ results = []
415
+ for func_name, expected in func_names_and_expected:
416
+ results.append((ndframe, func_name, expected))
417
+ return results
418
+
419
+
420
+ def get_op_from_name(op_name: str) -> Callable:
421
+ """
422
+ The operator function for a given op name.
423
+
424
+ Parameters
425
+ ----------
426
+ op_name : str
427
+ The op name, in form of "add" or "__add__".
428
+
429
+ Returns
430
+ -------
431
+ function
432
+ A function performing the operation.
433
+ """
434
+ short_opname = op_name.strip("_")
435
+ try:
436
+ op = getattr(operator, short_opname)
437
+ except AttributeError:
438
+ # Assume it is the reverse operator
439
+ rop = getattr(operator, short_opname[1:])
440
+ op = lambda x, y: rop(y, x)
441
+
442
+ return op
443
+
444
+
445
+ # -----------------------------------------------------------------------------
446
+ # Indexing test helpers
447
+
448
+
449
+ def getitem(x):
450
+ return x
451
+
452
+
453
+ def setitem(x):
454
+ return x
455
+
456
+
457
+ def loc(x):
458
+ return x.loc
459
+
460
+
461
+ def iloc(x):
462
+ return x.iloc
463
+
464
+
465
+ def at(x):
466
+ return x.at
467
+
468
+
469
+ def iat(x):
470
+ return x.iat
471
+
472
+
473
+ # -----------------------------------------------------------------------------
474
+
475
+ _UNITS = ["s", "ms", "us", "ns"]
476
+
477
+
478
+ def get_finest_unit(left: str, right: str) -> str:
479
+ """
480
+ Find the higher of two datetime64 units.
481
+ """
482
+ if _UNITS.index(left) >= _UNITS.index(right):
483
+ return left
484
+ return right
485
+
486
+
487
+ def shares_memory(left, right) -> bool:
488
+ """
489
+ Pandas-compat for np.shares_memory.
490
+ """
491
+ if isinstance(left, np.ndarray) and isinstance(right, np.ndarray):
492
+ return np.shares_memory(left, right)
493
+ elif isinstance(left, np.ndarray):
494
+ # Call with reversed args to get to unpacking logic below.
495
+ return shares_memory(right, left)
496
+
497
+ if isinstance(left, RangeIndex):
498
+ return False
499
+ if isinstance(left, MultiIndex):
500
+ return shares_memory(left._codes, right)
501
+ if isinstance(left, (Index, Series)):
502
+ if isinstance(right, (Index, Series)):
503
+ return shares_memory(left._values, right._values)
504
+ return shares_memory(left._values, right)
505
+
506
+ if isinstance(left, NDArrayBackedExtensionArray):
507
+ return shares_memory(left._ndarray, right)
508
+ if isinstance(left, pd.core.arrays.SparseArray):
509
+ return shares_memory(left.sp_values, right)
510
+ if isinstance(left, pd.core.arrays.IntervalArray):
511
+ return shares_memory(left._left, right) or shares_memory(left._right, right)
512
+
513
+ if isinstance(left, ArrowExtensionArray):
514
+ if isinstance(right, ArrowExtensionArray):
515
+ # https://github.com/pandas-dev/pandas/pull/43930#discussion_r736862669
516
+ left_pa_data = left._pa_array
517
+ right_pa_data = right._pa_array
518
+ left_buf1 = left_pa_data.chunk(0).buffers()[1]
519
+ right_buf1 = right_pa_data.chunk(0).buffers()[1]
520
+ return left_buf1.address == right_buf1.address
521
+ else:
522
+ # if we have one one ArrowExtensionArray and one other array, assume
523
+ # they can only share memory if they share the same numpy buffer
524
+ return np.shares_memory(left, right)
525
+
526
+ if isinstance(left, BaseMaskedArray) and isinstance(right, BaseMaskedArray):
527
+ # By convention, we'll say these share memory if they share *either*
528
+ # the _data or the _mask
529
+ return np.shares_memory(left._data, right._data) or np.shares_memory(
530
+ left._mask, right._mask
531
+ )
532
+
533
+ if isinstance(left, DataFrame) and len(left._mgr.blocks) == 1:
534
+ arr = left._mgr.blocks[0].values
535
+ return shares_memory(arr, right)
536
+
537
+ raise NotImplementedError(type(left), type(right))
538
+
539
+
540
+ def run_multithreaded(closure, max_workers, arguments=None, pass_barrier=False):
541
+ with ThreadPoolExecutor(max_workers=max_workers) as tpe:
542
+ if arguments is None:
543
+ arguments = []
544
+ else:
545
+ arguments = list(arguments)
546
+
547
+ if pass_barrier:
548
+ barrier = threading.Barrier(max_workers)
549
+ arguments.append(barrier)
550
+
551
+ try:
552
+ futures = []
553
+ for _ in range(max_workers):
554
+ futures.append(tpe.submit(closure, *arguments)) # noqa: PERF401
555
+ except RuntimeError as e:
556
+ import pytest
557
+
558
+ pytest.skip(
559
+ f"Spawning {max_workers} threads failed with "
560
+ f"error {e!r} (likely due to resource limits on the "
561
+ "system running the tests)"
562
+ )
563
+ finally:
564
+ if len(futures) < max_workers and pass_barrier:
565
+ barrier.abort()
566
+ for f in futures:
567
+ f.result()
568
+
569
+
570
+ __all__ = [
571
+ "ALL_INT_EA_DTYPES",
572
+ "ALL_INT_NUMPY_DTYPES",
573
+ "ALL_NUMPY_DTYPES",
574
+ "ALL_REAL_NUMPY_DTYPES",
575
+ "BOOL_DTYPES",
576
+ "BYTES_DTYPES",
577
+ "COMPLEX_DTYPES",
578
+ "DATETIME64_DTYPES",
579
+ "ENDIAN",
580
+ "FLOAT_EA_DTYPES",
581
+ "FLOAT_NUMPY_DTYPES",
582
+ "NARROW_NP_DTYPES",
583
+ "NP_NAT_OBJECTS",
584
+ "NULL_OBJECTS",
585
+ "OBJECT_DTYPES",
586
+ "SIGNED_INT_EA_DTYPES",
587
+ "SIGNED_INT_NUMPY_DTYPES",
588
+ "STRING_DTYPES",
589
+ "TIMEDELTA64_DTYPES",
590
+ "UNSIGNED_INT_EA_DTYPES",
591
+ "UNSIGNED_INT_NUMPY_DTYPES",
592
+ "SubclassedDataFrame",
593
+ "SubclassedSeries",
594
+ "assert_almost_equal",
595
+ "assert_attr_equal",
596
+ "assert_categorical_equal",
597
+ "assert_class_equal",
598
+ "assert_contains_all",
599
+ "assert_copy",
600
+ "assert_datetime_array_equal",
601
+ "assert_dict_equal",
602
+ "assert_equal",
603
+ "assert_extension_array_equal",
604
+ "assert_frame_equal",
605
+ "assert_index_equal",
606
+ "assert_indexing_slices_equivalent",
607
+ "assert_interval_array_equal",
608
+ "assert_is_sorted",
609
+ "assert_metadata_equivalent",
610
+ "assert_numpy_array_equal",
611
+ "assert_period_array_equal",
612
+ "assert_produces_warning",
613
+ "assert_series_equal",
614
+ "assert_sp_array_equal",
615
+ "assert_timedelta_array_equal",
616
+ "at",
617
+ "box_expected",
618
+ "can_set_locale",
619
+ "convert_rows_list_to_csv_str",
620
+ "decompress_file",
621
+ "external_error_raised",
622
+ "get_cython_table_params",
623
+ "get_dtype",
624
+ "get_finest_unit",
625
+ "get_locales",
626
+ "get_obj",
627
+ "get_op_from_name",
628
+ "getitem",
629
+ "iat",
630
+ "iloc",
631
+ "loc",
632
+ "maybe_produces_warning",
633
+ "raise_assert_detail",
634
+ "raises_chained_assignment_error",
635
+ "round_trip_pathlib",
636
+ "round_trip_pickle",
637
+ "run_multithreaded",
638
+ "set_locale",
639
+ "set_timezone",
640
+ "setitem",
641
+ "shares_memory",
642
+ "to_array",
643
+ "with_csv_dialect",
644
+ "write_to_compressed",
645
+ ]
.venv/lib/python3.11/site-packages/pandas/_testing/_hypothesis.py ADDED
@@ -0,0 +1,89 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Hypothesis data generator helpers.
3
+ """
4
+
5
+ from datetime import datetime
6
+
7
+ from hypothesis import strategies as st
8
+ from hypothesis.extra.dateutil import timezones as dateutil_timezones
9
+
10
+ from pandas.compat import is_platform_windows
11
+
12
+ import pandas as pd
13
+
14
+ from pandas.tseries.offsets import (
15
+ BMonthBegin,
16
+ BMonthEnd,
17
+ BQuarterBegin,
18
+ BQuarterEnd,
19
+ BYearBegin,
20
+ BYearEnd,
21
+ MonthBegin,
22
+ MonthEnd,
23
+ QuarterBegin,
24
+ QuarterEnd,
25
+ YearBegin,
26
+ YearEnd,
27
+ )
28
+
29
+ OPTIONAL_INTS = st.lists(st.one_of(st.integers(), st.none()), max_size=10, min_size=3)
30
+
31
+ OPTIONAL_FLOATS = st.lists(st.one_of(st.floats(), st.none()), max_size=10, min_size=3)
32
+
33
+ OPTIONAL_TEXT = st.lists(st.one_of(st.none(), st.text()), max_size=10, min_size=3)
34
+
35
+ OPTIONAL_DICTS = st.lists(
36
+ st.one_of(st.none(), st.dictionaries(st.text(), st.integers())),
37
+ max_size=10,
38
+ min_size=3,
39
+ )
40
+
41
+ OPTIONAL_LISTS = st.lists(
42
+ st.one_of(st.none(), st.lists(st.text(), max_size=10, min_size=3)),
43
+ max_size=10,
44
+ min_size=3,
45
+ )
46
+
47
+ OPTIONAL_ONE_OF_ALL = st.one_of(
48
+ OPTIONAL_DICTS, OPTIONAL_FLOATS, OPTIONAL_INTS, OPTIONAL_LISTS, OPTIONAL_TEXT
49
+ )
50
+
51
+ if is_platform_windows():
52
+ DATETIME_NO_TZ = st.datetimes(min_value=datetime(1900, 1, 1))
53
+ else:
54
+ DATETIME_NO_TZ = st.datetimes()
55
+
56
+ DATETIME_JAN_1_1900_OPTIONAL_TZ = st.datetimes( # pyright: ignore[reportCallIssue]
57
+ min_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportArgumentType]
58
+ max_value=pd.Timestamp(1900, 1, 1).to_pydatetime(), # pyright: ignore[reportArgumentType]
59
+ timezones=st.one_of(st.none(), dateutil_timezones(), st.timezones()),
60
+ )
61
+
62
+ DATETIME_IN_PD_TIMESTAMP_RANGE_NO_TZ = st.datetimes(
63
+ min_value=pd.Timestamp.min.to_pydatetime(warn=False),
64
+ max_value=pd.Timestamp.max.to_pydatetime(warn=False),
65
+ )
66
+
67
+ INT_NEG_999_TO_POS_999 = st.integers(-999, 999)
68
+
69
+ # The strategy for each type is registered in conftest.py, as they don't carry
70
+ # enough runtime information (e.g. type hints) to infer how to build them.
71
+ YQM_OFFSET = st.one_of(
72
+ *map(
73
+ st.from_type,
74
+ [
75
+ MonthBegin,
76
+ MonthEnd,
77
+ BMonthBegin,
78
+ BMonthEnd,
79
+ QuarterBegin,
80
+ QuarterEnd,
81
+ BQuarterBegin,
82
+ BQuarterEnd,
83
+ YearBegin,
84
+ YearEnd,
85
+ BYearBegin,
86
+ BYearEnd,
87
+ ],
88
+ )
89
+ )
.venv/lib/python3.11/site-packages/pandas/_testing/_io.py ADDED
@@ -0,0 +1,129 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import gzip
4
+ import io
5
+ import tarfile
6
+ from typing import (
7
+ TYPE_CHECKING,
8
+ Any,
9
+ )
10
+ import zipfile
11
+
12
+ from pandas.compat._optional import import_optional_dependency
13
+
14
+ import pandas as pd
15
+
16
+ if TYPE_CHECKING:
17
+ from collections.abc import Callable
18
+ from pathlib import Path
19
+
20
+ from pandas import (
21
+ DataFrame,
22
+ Series,
23
+ )
24
+
25
+ # ------------------------------------------------------------------
26
+ # File-IO
27
+
28
+
29
+ def round_trip_pickle(obj: Any, tmp_path: Path) -> DataFrame | Series:
30
+ """
31
+ Pickle an object and then read it again.
32
+
33
+ Parameters
34
+ ----------
35
+ obj : any object
36
+ The object to pickle and then re-read.
37
+ path : str, path object or file-like object, default None
38
+ The path where the pickled object is written and then read.
39
+
40
+ Returns
41
+ -------
42
+ pandas object
43
+ The original object that was pickled and then re-read.
44
+ """
45
+ pd.to_pickle(obj, tmp_path)
46
+ return pd.read_pickle(tmp_path)
47
+
48
+
49
+ def round_trip_pathlib(writer, reader, tmp_path: Path):
50
+ """
51
+ Write an object to file specified by a pathlib.Path and read it back
52
+
53
+ Parameters
54
+ ----------
55
+ writer : callable bound to pandas object
56
+ IO writing function (e.g. DataFrame.to_csv )
57
+ reader : callable
58
+ IO reading function (e.g. pd.read_csv )
59
+ path : str, default None
60
+ The path where the object is written and then read.
61
+
62
+ Returns
63
+ -------
64
+ pandas object
65
+ The original object that was serialized and then re-read.
66
+ """
67
+ writer(tmp_path)
68
+ obj = reader(tmp_path)
69
+ return obj
70
+
71
+
72
+ def write_to_compressed(compression, path: str, data, dest: str = "test") -> None:
73
+ """
74
+ Write data to a compressed file.
75
+
76
+ Parameters
77
+ ----------
78
+ compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd'}
79
+ The compression type to use.
80
+ path : str
81
+ The file path to write the data.
82
+ data : str
83
+ The data to write.
84
+ dest : str, default "test"
85
+ The destination file (for ZIP only)
86
+
87
+ Raises
88
+ ------
89
+ ValueError : An invalid compression value was passed in.
90
+ """
91
+ args: tuple[Any, ...] = (data,)
92
+ mode = "wb"
93
+ method = "write"
94
+ compress_method: Callable
95
+
96
+ if compression == "zip":
97
+ compress_method = zipfile.ZipFile
98
+ mode = "w"
99
+ args = (dest, data)
100
+ method = "writestr"
101
+ elif compression == "tar":
102
+ compress_method = tarfile.TarFile
103
+ mode = "w"
104
+ file = tarfile.TarInfo(name=dest)
105
+ bytes = io.BytesIO(data)
106
+ file.size = len(data)
107
+ args = (file, bytes)
108
+ method = "addfile"
109
+ elif compression == "gzip":
110
+ compress_method = gzip.GzipFile
111
+ elif compression == "bz2":
112
+ import bz2
113
+
114
+ compress_method = bz2.BZ2File
115
+ elif compression == "zstd":
116
+ compress_method = import_optional_dependency("zstandard").open
117
+ elif compression == "xz":
118
+ import lzma
119
+
120
+ compress_method = lzma.LZMAFile
121
+ else:
122
+ raise ValueError(f"Unrecognized compression type: {compression}")
123
+
124
+ # error: No overload variant of "ZipFile" matches argument types "str", "str"
125
+ # error: No overload variant of "BZ2File" matches argument types "str", "str"
126
+ # error: Argument "mode" to "TarFile" has incompatible type "str";
127
+ # expected "Literal['r', 'a', 'w', 'x']
128
+ with compress_method(path, mode=mode) as f: # type: ignore[call-overload, arg-type]
129
+ getattr(f, method)(*args)
.venv/lib/python3.11/site-packages/pandas/_testing/_warnings.py ADDED
@@ -0,0 +1,266 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from contextlib import (
4
+ AbstractContextManager,
5
+ contextmanager,
6
+ nullcontext,
7
+ )
8
+ import inspect
9
+ import re
10
+ import sys
11
+ from typing import (
12
+ TYPE_CHECKING,
13
+ Literal,
14
+ Union,
15
+ cast,
16
+ )
17
+ import warnings
18
+
19
+ if TYPE_CHECKING:
20
+ from collections.abc import (
21
+ Generator,
22
+ Sequence,
23
+ )
24
+
25
+
26
+ @contextmanager
27
+ def assert_produces_warning(
28
+ expected_warning: type[Warning] | bool | tuple[type[Warning], ...] | None = Warning,
29
+ filter_level: Literal[
30
+ "error", "ignore", "always", "default", "module", "once"
31
+ ] = "always",
32
+ check_stacklevel: bool = True,
33
+ raise_on_extra_warnings: bool = True,
34
+ match: str | tuple[str | None, ...] | None = None,
35
+ must_find_all_warnings: bool = True,
36
+ ) -> Generator[list[warnings.WarningMessage]]:
37
+ """
38
+ Context manager for running code expected to either raise a specific warning,
39
+ multiple specific warnings, or not raise any warnings. Verifies that the code
40
+ raises the expected warning(s), and that it does not raise any other unexpected
41
+ warnings. It is basically a wrapper around ``warnings.catch_warnings``.
42
+
43
+ Parameters
44
+ ----------
45
+ expected_warning : {Warning, False, tuple[Warning, ...], None}, default Warning
46
+ The type of Exception raised. ``exception.Warning`` is the base
47
+ class for all warnings. To raise multiple types of exceptions,
48
+ pass them as a tuple. To check that no warning is returned,
49
+ specify ``False`` or ``None``.
50
+ filter_level : str or None, default "always"
51
+ Specifies whether warnings are ignored, displayed, or turned
52
+ into errors.
53
+ Valid values are:
54
+
55
+ * "error" - turns matching warnings into exceptions
56
+ * "ignore" - discard the warning
57
+ * "always" - always emit a warning
58
+ * "default" - print the warning the first time it is generated
59
+ from each location
60
+ * "module" - print the warning the first time it is generated
61
+ from each module
62
+ * "once" - print the warning the first time it is generated
63
+
64
+ check_stacklevel : bool, default True
65
+ If True, displays the line that called the function containing
66
+ the warning to show were the function is called. Otherwise, the
67
+ line that implements the function is displayed.
68
+ raise_on_extra_warnings : bool, default True
69
+ Whether extra warnings not of the type `expected_warning` should
70
+ cause the test to fail.
71
+ match : {str, tuple[str, ...]}, optional
72
+ Match warning message. If it's a tuple, it has to be the size of
73
+ `expected_warning`. If additionally `must_find_all_warnings` is
74
+ True, each expected warning's message gets matched with a respective
75
+ match. Otherwise, multiple values get treated as an alternative.
76
+ must_find_all_warnings : bool, default True
77
+ If True and `expected_warning` is a tuple, each expected warning
78
+ type must get encountered. Otherwise, even one expected warning
79
+ results in success.
80
+
81
+ Examples
82
+ --------
83
+ >>> import warnings
84
+ >>> with assert_produces_warning():
85
+ ... warnings.warn(UserWarning())
86
+ >>> with assert_produces_warning(False):
87
+ ... warnings.warn(RuntimeWarning())
88
+ Traceback (most recent call last):
89
+ ...
90
+ AssertionError: Caused unexpected warning(s): ['RuntimeWarning'].
91
+ >>> with assert_produces_warning(UserWarning):
92
+ ... warnings.warn(RuntimeWarning())
93
+ Traceback (most recent call last):
94
+ ...
95
+ AssertionError: Did not see expected warning of class 'UserWarning'.
96
+
97
+ ..warn:: This is *not* thread-safe.
98
+ """
99
+ __tracebackhide__ = True
100
+
101
+ with warnings.catch_warnings(record=True) as w:
102
+ warnings.simplefilter(filter_level)
103
+ try:
104
+ yield w
105
+ finally:
106
+ if expected_warning:
107
+ if isinstance(expected_warning, tuple) and must_find_all_warnings:
108
+ match = (
109
+ match
110
+ if isinstance(match, tuple)
111
+ else (match,) * len(expected_warning)
112
+ )
113
+ for warning_type, warning_match in zip(
114
+ expected_warning, match, strict=True
115
+ ):
116
+ _assert_caught_expected_warnings(
117
+ caught_warnings=w,
118
+ expected_warning=warning_type,
119
+ match=warning_match,
120
+ check_stacklevel=check_stacklevel,
121
+ )
122
+ else:
123
+ expected_warning = cast(
124
+ Union[type[Warning], tuple[type[Warning], ...]],
125
+ expected_warning,
126
+ )
127
+ match = (
128
+ "|".join(m for m in match if m)
129
+ if isinstance(match, tuple)
130
+ else match
131
+ )
132
+ _assert_caught_expected_warnings(
133
+ caught_warnings=w,
134
+ expected_warning=expected_warning,
135
+ match=match,
136
+ check_stacklevel=check_stacklevel,
137
+ )
138
+ if raise_on_extra_warnings:
139
+ _assert_caught_no_extra_warnings(
140
+ caught_warnings=w,
141
+ expected_warning=expected_warning,
142
+ )
143
+
144
+
145
+ def maybe_produces_warning(
146
+ warning: type[Warning], condition: bool, **kwargs
147
+ ) -> AbstractContextManager:
148
+ """
149
+ Return a context manager that possibly checks a warning based on the condition
150
+ """
151
+ if condition:
152
+ return assert_produces_warning(warning, **kwargs)
153
+ else:
154
+ return nullcontext()
155
+
156
+
157
+ def _assert_caught_expected_warnings(
158
+ *,
159
+ caught_warnings: Sequence[warnings.WarningMessage],
160
+ expected_warning: type[Warning] | tuple[type[Warning], ...],
161
+ match: str | None,
162
+ check_stacklevel: bool,
163
+ ) -> None:
164
+ """Assert that there was the expected warning among the caught warnings."""
165
+ saw_warning = False
166
+ matched_message = False
167
+ unmatched_messages = []
168
+ warning_name = (
169
+ tuple(x.__name__ for x in expected_warning)
170
+ if isinstance(expected_warning, tuple)
171
+ else expected_warning.__name__
172
+ )
173
+
174
+ for actual_warning in caught_warnings:
175
+ if issubclass(actual_warning.category, expected_warning):
176
+ saw_warning = True
177
+
178
+ if check_stacklevel:
179
+ _assert_raised_with_correct_stacklevel(actual_warning)
180
+
181
+ if match is not None:
182
+ if re.search(match, str(actual_warning.message)):
183
+ matched_message = True
184
+ else:
185
+ unmatched_messages.append(actual_warning.message)
186
+
187
+ if not saw_warning:
188
+ raise AssertionError(f"Did not see expected warning of class {warning_name!r}")
189
+
190
+ if match and not matched_message:
191
+ raise AssertionError(
192
+ f"Did not see warning {warning_name!r} "
193
+ f"matching '{match}'. The emitted warning messages are "
194
+ f"{unmatched_messages}"
195
+ )
196
+
197
+
198
+ def _assert_caught_no_extra_warnings(
199
+ *,
200
+ caught_warnings: Sequence[warnings.WarningMessage],
201
+ expected_warning: type[Warning] | bool | tuple[type[Warning], ...] | None,
202
+ ) -> None:
203
+ """Assert that no extra warnings apart from the expected ones are caught."""
204
+ extra_warnings = []
205
+
206
+ for actual_warning in caught_warnings:
207
+ if _is_unexpected_warning(actual_warning, expected_warning):
208
+ # GH#38630 pytest.filterwarnings does not suppress these.
209
+ if actual_warning.category == ResourceWarning:
210
+ # GH 44732: Don't make the CI flaky by filtering SSL-related
211
+ # ResourceWarning from dependencies
212
+ if "unclosed <ssl.SSLSocket" in str(actual_warning.message):
213
+ continue
214
+ # GH 44844: Matplotlib leaves font files open during the entire process
215
+ # upon import. Don't make CI flaky if ResourceWarning raised
216
+ # due to these open files.
217
+ if any("matplotlib" in mod for mod in sys.modules):
218
+ continue
219
+ if actual_warning.category == EncodingWarning:
220
+ # EncodingWarnings are checked in the CI
221
+ # pyproject.toml errors on EncodingWarnings in pandas
222
+ # Ignore EncodingWarnings from other libraries
223
+ continue
224
+ extra_warnings.append(
225
+ (
226
+ actual_warning.category.__name__,
227
+ actual_warning.message,
228
+ actual_warning.filename,
229
+ actual_warning.lineno,
230
+ )
231
+ )
232
+
233
+ if extra_warnings:
234
+ raise AssertionError(f"Caused unexpected warning(s): {extra_warnings!r}")
235
+
236
+
237
+ def _is_unexpected_warning(
238
+ actual_warning: warnings.WarningMessage,
239
+ expected_warning: type[Warning] | bool | tuple[type[Warning], ...] | None,
240
+ ) -> bool:
241
+ """Check if the actual warning issued is unexpected."""
242
+ if actual_warning and not expected_warning:
243
+ return True
244
+ expected_warning = cast(type[Warning], expected_warning)
245
+ return bool(not issubclass(actual_warning.category, expected_warning))
246
+
247
+
248
+ def _assert_raised_with_correct_stacklevel(
249
+ actual_warning: warnings.WarningMessage,
250
+ ) -> None:
251
+ # https://stackoverflow.com/questions/17407119/python-inspect-stack-is-slow
252
+ frame = inspect.currentframe()
253
+ for _ in range(4):
254
+ frame = frame.f_back # type: ignore[union-attr]
255
+ try:
256
+ caller_filename = inspect.getfile(frame) # type: ignore[arg-type]
257
+ finally:
258
+ # See note in
259
+ # https://docs.python.org/3/library/inspect.html#inspect.Traceback
260
+ del frame
261
+ msg = (
262
+ "Warning not set with correct stacklevel. "
263
+ f"File where warning is raised: {actual_warning.filename} != "
264
+ f"{caller_filename}. Warning message: {actual_warning.message}"
265
+ )
266
+ assert actual_warning.filename == caller_filename, msg
.venv/lib/python3.11/site-packages/pandas/_testing/asserters.py ADDED
@@ -0,0 +1,1503 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ import operator
4
+ from typing import (
5
+ TYPE_CHECKING,
6
+ Literal,
7
+ NoReturn,
8
+ cast,
9
+ )
10
+ import warnings
11
+
12
+ import numpy as np
13
+
14
+ from pandas._libs import lib
15
+ from pandas._libs.missing import is_matching_na
16
+ from pandas._libs.sparse import SparseIndex
17
+ import pandas._libs.testing as _testing
18
+ from pandas._libs.tslibs.np_datetime import compare_mismatched_resolutions
19
+ from pandas.errors import Pandas4Warning
20
+ from pandas.util._decorators import (
21
+ deprecate_kwarg,
22
+ set_module,
23
+ )
24
+
25
+ from pandas.core.dtypes.common import (
26
+ is_bool,
27
+ is_float_dtype,
28
+ is_integer_dtype,
29
+ is_number,
30
+ is_numeric_dtype,
31
+ needs_i8_conversion,
32
+ )
33
+ from pandas.core.dtypes.dtypes import (
34
+ CategoricalDtype,
35
+ DatetimeTZDtype,
36
+ ExtensionDtype,
37
+ NumpyEADtype,
38
+ )
39
+ from pandas.core.dtypes.missing import array_equivalent
40
+
41
+ import pandas as pd
42
+ from pandas import (
43
+ Categorical,
44
+ DataFrame,
45
+ DatetimeIndex,
46
+ Index,
47
+ IntervalDtype,
48
+ IntervalIndex,
49
+ MultiIndex,
50
+ PeriodIndex,
51
+ RangeIndex,
52
+ Series,
53
+ TimedeltaIndex,
54
+ )
55
+ from pandas.core.arrays import (
56
+ DatetimeArray,
57
+ ExtensionArray,
58
+ IntervalArray,
59
+ PeriodArray,
60
+ TimedeltaArray,
61
+ )
62
+ from pandas.core.arrays.datetimelike import DatetimeLikeArrayMixin
63
+ from pandas.core.arrays.string_ import StringDtype
64
+ from pandas.core.indexes.api import safe_sort_index
65
+
66
+ from pandas.io.formats.printing import pprint_thing
67
+
68
+ if TYPE_CHECKING:
69
+ from pandas._typing import DtypeObj
70
+
71
+
72
+ def assert_almost_equal(
73
+ left,
74
+ right,
75
+ check_dtype: bool | Literal["equiv"] = "equiv",
76
+ rtol: float = 1.0e-5,
77
+ atol: float = 1.0e-8,
78
+ **kwargs,
79
+ ) -> None:
80
+ """
81
+ Check that the left and right objects are approximately equal.
82
+
83
+ By approximately equal, we refer to objects that are numbers or that
84
+ contain numbers which may be equivalent to specific levels of precision.
85
+
86
+ Parameters
87
+ ----------
88
+ left : object
89
+ right : object
90
+ check_dtype : bool or {'equiv'}, default 'equiv'
91
+ Check dtype if both a and b are the same type. If 'equiv' is passed in,
92
+ then `RangeIndex` and `Index` with int64 dtype are also considered
93
+ equivalent when doing type checking.
94
+ rtol : float, default 1e-5
95
+ Relative tolerance.
96
+ atol : float, default 1e-8
97
+ Absolute tolerance.
98
+ """
99
+ if isinstance(left, Index):
100
+ assert_index_equal(
101
+ left,
102
+ right,
103
+ check_exact=False,
104
+ exact=check_dtype,
105
+ rtol=rtol,
106
+ atol=atol,
107
+ **kwargs,
108
+ )
109
+
110
+ elif isinstance(left, Series):
111
+ assert_series_equal(
112
+ left,
113
+ right,
114
+ check_exact=False,
115
+ check_dtype=check_dtype,
116
+ rtol=rtol,
117
+ atol=atol,
118
+ **kwargs,
119
+ )
120
+
121
+ elif isinstance(left, DataFrame):
122
+ assert_frame_equal(
123
+ left,
124
+ right,
125
+ check_exact=False,
126
+ check_dtype=check_dtype,
127
+ rtol=rtol,
128
+ atol=atol,
129
+ **kwargs,
130
+ )
131
+
132
+ else:
133
+ # Other sequences.
134
+ if check_dtype:
135
+ if is_number(left) and is_number(right):
136
+ # Do not compare numeric classes, like np.float64 and float.
137
+ pass
138
+ elif is_bool(left) and is_bool(right):
139
+ # Do not compare bool classes, like np.bool_ and bool.
140
+ pass
141
+ else:
142
+ if isinstance(left, np.ndarray) or isinstance(right, np.ndarray):
143
+ obj = "numpy array"
144
+ else:
145
+ obj = "Input"
146
+ assert_class_equal(left, right, obj=obj)
147
+
148
+ # if we have "equiv", this becomes True
149
+ _testing.assert_almost_equal(
150
+ left, right, check_dtype=bool(check_dtype), rtol=rtol, atol=atol, **kwargs
151
+ )
152
+
153
+
154
+ def _check_isinstance(left, right, cls) -> None:
155
+ """
156
+ Helper method for our assert_* methods that ensures that
157
+ the two objects being compared have the right type before
158
+ proceeding with the comparison.
159
+
160
+ Parameters
161
+ ----------
162
+ left : The first object being compared.
163
+ right : The second object being compared.
164
+ cls : The class type to check against.
165
+
166
+ Raises
167
+ ------
168
+ AssertionError : Either `left` or `right` is not an instance of `cls`.
169
+ """
170
+ cls_name = cls.__name__
171
+
172
+ if not isinstance(left, cls):
173
+ raise AssertionError(
174
+ f"{cls_name} Expected type {cls}, found {type(left)} instead"
175
+ )
176
+ if not isinstance(right, cls):
177
+ raise AssertionError(
178
+ f"{cls_name} Expected type {cls}, found {type(right)} instead"
179
+ )
180
+
181
+
182
+ def assert_dict_equal(left, right, compare_keys: bool = True) -> None:
183
+ _check_isinstance(left, right, dict)
184
+ _testing.assert_dict_equal(left, right, compare_keys=compare_keys)
185
+
186
+
187
+ @set_module("pandas.testing")
188
+ def assert_index_equal(
189
+ left: Index,
190
+ right: Index,
191
+ exact: bool | str = "equiv",
192
+ check_names: bool = True,
193
+ check_exact: bool = True,
194
+ check_categorical: bool = True,
195
+ check_order: bool = True,
196
+ rtol: float = 1.0e-5,
197
+ atol: float = 1.0e-8,
198
+ obj: str | None = None,
199
+ ) -> None:
200
+ """
201
+ Check that left and right Index are equal.
202
+
203
+ Parameters
204
+ ----------
205
+ left : Index
206
+ The first index to compare.
207
+ right : Index
208
+ The second index to compare.
209
+ exact : bool or {'equiv'}, default 'equiv'
210
+ Whether to check the Index class, dtype and inferred_type
211
+ are identical. If 'equiv', then RangeIndex can be substituted for
212
+ Index with an int64 dtype as well.
213
+ check_names : bool, default True
214
+ Whether to check the names attribute.
215
+ check_exact : bool, default True
216
+ Whether to compare number exactly.
217
+ check_categorical : bool, default True
218
+ Whether to compare internal Categorical exactly.
219
+ check_order : bool, default True
220
+ Whether to compare the order of index entries as well as their values.
221
+ If True, both indexes must contain the same elements, in the same order.
222
+ If False, both indexes must contain the same elements, but in any order.
223
+ rtol : float, default 1e-5
224
+ Relative tolerance. Only used when check_exact is False.
225
+ atol : float, default 1e-8
226
+ Absolute tolerance. Only used when check_exact is False.
227
+ obj : str, default 'Index' or 'MultiIndex'
228
+ Specify object name being compared, internally used to show appropriate
229
+ assertion message.
230
+
231
+ See Also
232
+ --------
233
+ testing.assert_series_equal : Check that two Series are equal.
234
+ testing.assert_frame_equal : Check that two DataFrames are equal.
235
+
236
+ Examples
237
+ --------
238
+ >>> from pandas import testing as tm
239
+ >>> a = pd.Index([1, 2, 3])
240
+ >>> b = pd.Index([1, 2, 3])
241
+ >>> tm.assert_index_equal(a, b)
242
+ """
243
+ __tracebackhide__ = True
244
+
245
+ if obj is None:
246
+ obj = "MultiIndex" if isinstance(left, MultiIndex) else "Index"
247
+
248
+ def _check_types(left, right, obj: str = "Index") -> None:
249
+ if not exact:
250
+ return
251
+
252
+ assert_class_equal(left, right, exact=exact, obj=obj)
253
+ assert_attr_equal("inferred_type", left, right, obj=obj)
254
+
255
+ # Skip exact dtype checking when `check_categorical` is False
256
+ if isinstance(left.dtype, CategoricalDtype) and isinstance(
257
+ right.dtype, CategoricalDtype
258
+ ):
259
+ if check_categorical:
260
+ assert_attr_equal("dtype", left, right, obj=obj)
261
+ assert_index_equal(left.categories, right.categories, exact=exact)
262
+ return
263
+
264
+ assert_attr_equal("dtype", left, right, obj=obj)
265
+
266
+ # instance validation
267
+ _check_isinstance(left, right, Index)
268
+
269
+ # class / dtype comparison
270
+ _check_types(left, right, obj=obj)
271
+
272
+ # level comparison
273
+ if left.nlevels != right.nlevels:
274
+ msg1 = f"{obj} levels are different"
275
+ msg2 = f"{left.nlevels}, {left}"
276
+ msg3 = f"{right.nlevels}, {right}"
277
+ raise_assert_detail(obj, msg1, msg2, msg3)
278
+
279
+ # length comparison
280
+ if len(left) != len(right):
281
+ msg1 = f"{obj} length are different"
282
+ msg2 = f"{len(left)}, {left}"
283
+ msg3 = f"{len(right)}, {right}"
284
+ raise_assert_detail(obj, msg1, msg2, msg3)
285
+
286
+ # If order doesn't matter then sort the index entries
287
+ if not check_order:
288
+ left = safe_sort_index(left)
289
+ right = safe_sort_index(right)
290
+
291
+ # MultiIndex special comparison for little-friendly error messages
292
+ if isinstance(left, MultiIndex):
293
+ right = cast(MultiIndex, right)
294
+
295
+ for level in range(left.nlevels):
296
+ lobj = f"{obj} level [{level}]"
297
+ try:
298
+ # try comparison on levels/codes to avoid densifying MultiIndex
299
+ assert_index_equal(
300
+ left.levels[level],
301
+ right.levels[level],
302
+ exact=exact,
303
+ check_names=check_names,
304
+ check_exact=check_exact,
305
+ check_categorical=check_categorical,
306
+ rtol=rtol,
307
+ atol=atol,
308
+ obj=lobj,
309
+ )
310
+ assert_numpy_array_equal(left.codes[level], right.codes[level])
311
+ except AssertionError:
312
+ llevel = left.get_level_values(level)
313
+ rlevel = right.get_level_values(level)
314
+
315
+ assert_index_equal(
316
+ llevel,
317
+ rlevel,
318
+ exact=exact,
319
+ check_names=check_names,
320
+ check_exact=check_exact,
321
+ check_categorical=check_categorical,
322
+ rtol=rtol,
323
+ atol=atol,
324
+ obj=lobj,
325
+ )
326
+ # get_level_values may change dtype
327
+ _check_types(left.levels[level], right.levels[level], obj=lobj)
328
+
329
+ # skip exact index checking when `check_categorical` is False
330
+ elif check_exact and check_categorical:
331
+ if not left.equals(right):
332
+ # _values compare can raise TypeError (non-comparable
333
+ # categoricals (GH#61935)
334
+ try:
335
+ mismatch = left._values != right._values
336
+ except TypeError:
337
+ raise_assert_detail(
338
+ obj,
339
+ "types are not comparable (non-matching categorical categories)",
340
+ left,
341
+ right,
342
+ )
343
+
344
+ if not isinstance(mismatch, np.ndarray):
345
+ mismatch = cast("ExtensionArray", mismatch).fillna(True)
346
+
347
+ diff = np.sum(mismatch.astype(int)) * 100.0 / len(left)
348
+ msg = f"{obj} values are different ({np.round(diff, 5)} %)"
349
+ raise_assert_detail(obj, msg, left, right)
350
+ else:
351
+ # if we have "equiv", this becomes True
352
+ exact_bool = bool(exact)
353
+ _testing.assert_almost_equal(
354
+ left.values,
355
+ right.values,
356
+ rtol=rtol,
357
+ atol=atol,
358
+ check_dtype=exact_bool,
359
+ obj=obj,
360
+ lobj=left,
361
+ robj=right,
362
+ )
363
+
364
+ # metadata comparison
365
+ if check_names:
366
+ assert_attr_equal("names", left, right, obj=obj)
367
+ if isinstance(left, PeriodIndex) or isinstance(right, PeriodIndex):
368
+ assert_attr_equal("dtype", left, right, obj=obj)
369
+ if isinstance(left, IntervalIndex) or isinstance(right, IntervalIndex):
370
+ assert_interval_array_equal(left._values, right._values)
371
+
372
+ if check_categorical:
373
+ if isinstance(left.dtype, CategoricalDtype) or isinstance(
374
+ right.dtype, CategoricalDtype
375
+ ):
376
+ assert_categorical_equal(left._values, right._values, obj=f"{obj} category")
377
+
378
+
379
+ def assert_class_equal(
380
+ left, right, exact: bool | str = True, obj: str = "Input"
381
+ ) -> None:
382
+ """
383
+ Checks classes are equal.
384
+ """
385
+ __tracebackhide__ = True
386
+
387
+ def repr_class(x):
388
+ if isinstance(x, Index):
389
+ # return Index as it is to include values in the error message
390
+ return x
391
+
392
+ return type(x).__name__
393
+
394
+ def is_class_equiv(idx: Index) -> bool:
395
+ """Classes that are a RangeIndex (sub-)instance or exactly an `Index` .
396
+
397
+ This only checks class equivalence. There is a separate check that the
398
+ dtype is int64.
399
+ """
400
+ return type(idx) is Index or isinstance(idx, RangeIndex)
401
+
402
+ if type(left) == type(right):
403
+ return
404
+
405
+ if exact == "equiv":
406
+ if is_class_equiv(left) and is_class_equiv(right):
407
+ return
408
+
409
+ msg = f"{obj} classes are different"
410
+ raise_assert_detail(obj, msg, repr_class(left), repr_class(right))
411
+
412
+
413
+ def assert_attr_equal(attr: str, left, right, obj: str = "Attributes") -> None:
414
+ """
415
+ Check attributes are equal. Both objects must have attribute.
416
+
417
+ Parameters
418
+ ----------
419
+ attr : str
420
+ Attribute name being compared.
421
+ left : object
422
+ right : object
423
+ obj : str, default 'Attributes'
424
+ Specify object name being compared, internally used to show appropriate
425
+ assertion message
426
+ """
427
+ __tracebackhide__ = True
428
+
429
+ left_attr = getattr(left, attr)
430
+ right_attr = getattr(right, attr)
431
+
432
+ if left_attr is right_attr or is_matching_na(left_attr, right_attr):
433
+ # e.g. both np.nan, both NaT, both pd.NA, ...
434
+ return None
435
+
436
+ try:
437
+ result = left_attr == right_attr
438
+ except TypeError:
439
+ # datetimetz on rhs may raise TypeError
440
+ result = False
441
+ if (left_attr is pd.NA) ^ (right_attr is pd.NA):
442
+ result = False
443
+ elif not isinstance(result, bool):
444
+ result = result.all()
445
+
446
+ if not result:
447
+ msg = f'Attribute "{attr}" are different'
448
+ raise_assert_detail(obj, msg, left_attr, right_attr)
449
+ return None
450
+
451
+
452
+ def assert_is_sorted(seq) -> None:
453
+ """Assert that the sequence is sorted."""
454
+ if isinstance(seq, (Index, Series)):
455
+ seq = seq.values
456
+ # sorting does not change precisions
457
+ if isinstance(seq, np.ndarray):
458
+ assert_numpy_array_equal(seq, np.sort(np.array(seq)))
459
+ else:
460
+ assert_extension_array_equal(seq, seq[seq.argsort()])
461
+
462
+
463
+ def assert_categorical_equal(
464
+ left,
465
+ right,
466
+ check_dtype: bool = True,
467
+ check_category_order: bool = True,
468
+ obj: str = "Categorical",
469
+ ) -> None:
470
+ """
471
+ Test that Categoricals are equivalent.
472
+
473
+ Parameters
474
+ ----------
475
+ left : Categorical
476
+ right : Categorical
477
+ check_dtype : bool, default True
478
+ Check that integer dtype of the codes are the same.
479
+ check_category_order : bool, default True
480
+ Whether the order of the categories should be compared, which
481
+ implies identical integer codes. If False, only the resulting
482
+ values are compared. The ordered attribute is
483
+ checked regardless.
484
+ obj : str, default 'Categorical'
485
+ Specify object name being compared, internally used to show appropriate
486
+ assertion message.
487
+ """
488
+ _check_isinstance(left, right, Categorical)
489
+
490
+ exact: bool | str
491
+ if isinstance(left.categories, RangeIndex) or isinstance(
492
+ right.categories, RangeIndex
493
+ ):
494
+ exact = "equiv"
495
+ else:
496
+ # We still want to require exact matches for Index
497
+ exact = True
498
+
499
+ if check_category_order:
500
+ assert_index_equal(
501
+ left.categories, right.categories, obj=f"{obj}.categories", exact=exact
502
+ )
503
+ assert_numpy_array_equal(
504
+ left.codes, right.codes, check_dtype=check_dtype, obj=f"{obj}.codes"
505
+ )
506
+ else:
507
+ try:
508
+ lc = left.categories.sort_values()
509
+ rc = right.categories.sort_values()
510
+ except TypeError:
511
+ # e.g. '<' not supported between instances of 'int' and 'str'
512
+ lc, rc = left.categories, right.categories
513
+ assert_index_equal(lc, rc, obj=f"{obj}.categories", exact=exact)
514
+ assert_index_equal(
515
+ left.categories.take(left.codes),
516
+ right.categories.take(right.codes),
517
+ obj=f"{obj}.values",
518
+ exact=exact,
519
+ )
520
+
521
+ assert_attr_equal("ordered", left, right, obj=obj)
522
+
523
+
524
+ def assert_interval_array_equal(
525
+ left, right, exact: bool | Literal["equiv"] = "equiv", obj: str = "IntervalArray"
526
+ ) -> None:
527
+ """
528
+ Test that two IntervalArrays are equivalent.
529
+
530
+ Parameters
531
+ ----------
532
+ left, right : IntervalArray
533
+ The IntervalArrays to compare.
534
+ exact : bool or {'equiv'}, default 'equiv'
535
+ Whether to check the Index class, dtype and inferred_type
536
+ are identical. If 'equiv', then RangeIndex can be substituted for
537
+ Index with an int64 dtype as well.
538
+ obj : str, default 'IntervalArray'
539
+ Specify object name being compared, internally used to show appropriate
540
+ assertion message
541
+ """
542
+ _check_isinstance(left, right, IntervalArray)
543
+
544
+ kwargs = {}
545
+ if left._left.dtype.kind in "mM":
546
+ # We have a DatetimeArray or TimedeltaArray
547
+ kwargs["check_freq"] = False
548
+
549
+ assert_equal(left._left, right._left, obj=f"{obj}.left", **kwargs)
550
+ assert_equal(left._right, right._right, obj=f"{obj}.right", **kwargs)
551
+
552
+ assert_attr_equal("closed", left, right, obj=obj)
553
+
554
+
555
+ def assert_period_array_equal(left, right, obj: str = "PeriodArray") -> None:
556
+ _check_isinstance(left, right, PeriodArray)
557
+
558
+ assert_numpy_array_equal(left._ndarray, right._ndarray, obj=f"{obj}._ndarray")
559
+ assert_attr_equal("dtype", left, right, obj=obj)
560
+
561
+
562
+ def assert_datetime_array_equal(
563
+ left, right, obj: str = "DatetimeArray", check_freq: bool = True
564
+ ) -> None:
565
+ __tracebackhide__ = True
566
+ _check_isinstance(left, right, DatetimeArray)
567
+
568
+ assert_numpy_array_equal(left._ndarray, right._ndarray, obj=f"{obj}._ndarray")
569
+ if check_freq:
570
+ assert_attr_equal("freq", left, right, obj=obj)
571
+ assert_attr_equal("tz", left, right, obj=obj)
572
+
573
+
574
+ def assert_timedelta_array_equal(
575
+ left, right, obj: str = "TimedeltaArray", check_freq: bool = True
576
+ ) -> None:
577
+ __tracebackhide__ = True
578
+ _check_isinstance(left, right, TimedeltaArray)
579
+ assert_numpy_array_equal(left._ndarray, right._ndarray, obj=f"{obj}._ndarray")
580
+ if check_freq:
581
+ assert_attr_equal("freq", left, right, obj=obj)
582
+
583
+
584
+ def raise_assert_detail(
585
+ obj, message, left, right, diff=None, first_diff=None, index_values=None
586
+ ) -> NoReturn:
587
+ __tracebackhide__ = True
588
+
589
+ msg = f"""{obj} are different
590
+
591
+ {message}"""
592
+
593
+ if isinstance(index_values, Index):
594
+ index_values = np.asarray(index_values)
595
+
596
+ if isinstance(index_values, np.ndarray):
597
+ msg += f"\n[index]: {pprint_thing(index_values)}"
598
+
599
+ if isinstance(left, np.ndarray):
600
+ left = pprint_thing(left)
601
+ elif isinstance(left, (CategoricalDtype, StringDtype, NumpyEADtype)):
602
+ left = repr(left)
603
+
604
+ if isinstance(right, np.ndarray):
605
+ right = pprint_thing(right)
606
+ elif isinstance(right, (CategoricalDtype, StringDtype, NumpyEADtype)):
607
+ right = repr(right)
608
+
609
+ msg += f"""
610
+ [left]: {left}
611
+ [right]: {right}"""
612
+
613
+ if diff is not None:
614
+ msg += f"\n[diff]: {diff}"
615
+
616
+ if first_diff is not None:
617
+ msg += f"\n{first_diff}"
618
+
619
+ raise AssertionError(msg)
620
+
621
+
622
+ def assert_numpy_array_equal(
623
+ left,
624
+ right,
625
+ strict_nan: bool = False,
626
+ check_dtype: bool | Literal["equiv"] = True,
627
+ err_msg=None,
628
+ check_same=None,
629
+ obj: str = "numpy array",
630
+ index_values=None,
631
+ ) -> None:
632
+ """
633
+ Check that 'np.ndarray' is equivalent.
634
+
635
+ Parameters
636
+ ----------
637
+ left, right : numpy.ndarray or iterable
638
+ The two arrays to be compared.
639
+ strict_nan : bool, default False
640
+ If True, consider NaN and None to be different.
641
+ check_dtype : bool, default True
642
+ Check dtype if both a and b are np.ndarray.
643
+ err_msg : str, default None
644
+ If provided, used as assertion message.
645
+ check_same : None|'copy'|'same', default None
646
+ Ensure left and right refer/do not refer to the same memory area.
647
+ obj : str, default 'numpy array'
648
+ Specify object name being compared, internally used to show appropriate
649
+ assertion message.
650
+ index_values : Index | numpy.ndarray, default None
651
+ optional index (shared by both left and right), used in output.
652
+ """
653
+ __tracebackhide__ = True
654
+
655
+ # instance validation
656
+ # Show a detailed error message when classes are different
657
+ assert_class_equal(left, right, obj=obj)
658
+ # both classes must be an np.ndarray
659
+ _check_isinstance(left, right, np.ndarray)
660
+
661
+ def _get_base(obj):
662
+ return obj.base if getattr(obj, "base", None) is not None else obj
663
+
664
+ left_base = _get_base(left)
665
+ right_base = _get_base(right)
666
+
667
+ if check_same == "same":
668
+ if left_base is not right_base:
669
+ raise AssertionError(f"{left_base!r} is not {right_base!r}")
670
+ elif check_same == "copy":
671
+ if left_base is right_base:
672
+ raise AssertionError(f"{left_base!r} is {right_base!r}")
673
+
674
+ def _raise(left, right, err_msg) -> NoReturn:
675
+ if err_msg is None:
676
+ if left.shape != right.shape:
677
+ raise_assert_detail(
678
+ obj, f"{obj} shapes are different", left.shape, right.shape
679
+ )
680
+
681
+ diff = 0
682
+ for left_arr, right_arr in zip(left, right, strict=True):
683
+ # count up differences
684
+ if not array_equivalent(left_arr, right_arr, strict_nan=strict_nan):
685
+ diff += 1
686
+
687
+ diff = diff * 100.0 / left.size
688
+ msg = f"{obj} values are different ({np.round(diff, 5)} %)"
689
+ raise_assert_detail(obj, msg, left, right, index_values=index_values)
690
+
691
+ raise AssertionError(err_msg)
692
+
693
+ # compare shape and values
694
+ if not array_equivalent(left, right, strict_nan=strict_nan):
695
+ _raise(left, right, err_msg)
696
+
697
+ if check_dtype:
698
+ if isinstance(left, np.ndarray) and isinstance(right, np.ndarray):
699
+ assert_attr_equal("dtype", left, right, obj=obj)
700
+
701
+
702
+ @set_module("pandas.testing")
703
+ def assert_extension_array_equal(
704
+ left,
705
+ right,
706
+ check_dtype: bool | Literal["equiv"] = True,
707
+ index_values=None,
708
+ check_exact: bool | lib.NoDefault = lib.no_default,
709
+ rtol: float | lib.NoDefault = lib.no_default,
710
+ atol: float | lib.NoDefault = lib.no_default,
711
+ obj: str = "ExtensionArray",
712
+ ) -> None:
713
+ """
714
+ Check that left and right ExtensionArrays are equal.
715
+
716
+ This method compares two ``ExtensionArray`` instances for equality,
717
+ including checks for missing values, the dtype of the arrays, and
718
+ the exactness of the comparison (or tolerance when comparing floats).
719
+
720
+ Parameters
721
+ ----------
722
+ left, right : ExtensionArray
723
+ The two arrays to compare.
724
+ check_dtype : bool, default True
725
+ Whether to check if the ExtensionArray dtypes are identical.
726
+ index_values : Index | numpy.ndarray, default None
727
+ Optional index (shared by both left and right), used in output.
728
+ check_exact : bool, default False
729
+ Whether to compare number exactly.
730
+
731
+ .. versionchanged:: 2.2.0
732
+
733
+ Defaults to True for integer dtypes if none of
734
+ ``check_exact``, ``rtol`` and ``atol`` are specified.
735
+ rtol : float, default 1e-5
736
+ Relative tolerance. Only used when check_exact is False.
737
+ atol : float, default 1e-8
738
+ Absolute tolerance. Only used when check_exact is False.
739
+ obj : str, default 'ExtensionArray'
740
+ Specify object name being compared, internally used to show appropriate
741
+ assertion message.
742
+
743
+ .. versionadded:: 2.0.0
744
+
745
+ See Also
746
+ --------
747
+ testing.assert_series_equal : Check that left and right ``Series`` are equal.
748
+ testing.assert_frame_equal : Check that left and right ``DataFrame`` are equal.
749
+ testing.assert_index_equal : Check that left and right ``Index`` are equal.
750
+
751
+ Notes
752
+ -----
753
+ Missing values are checked separately from valid values.
754
+ A mask of missing values is computed for each and checked to match.
755
+ The remaining all-valid values are cast to object dtype and checked.
756
+
757
+ Examples
758
+ --------
759
+ >>> from pandas import testing as tm
760
+ >>> a = pd.Series([1, 2, 3, 4])
761
+ >>> b, c = a.array, a.array
762
+ >>> tm.assert_extension_array_equal(b, c)
763
+ """
764
+ if (
765
+ check_exact is lib.no_default
766
+ and rtol is lib.no_default
767
+ and atol is lib.no_default
768
+ ):
769
+ check_exact = (
770
+ is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
771
+ ) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
772
+ elif check_exact is lib.no_default:
773
+ check_exact = False
774
+
775
+ rtol = rtol if rtol is not lib.no_default else 1.0e-5
776
+ atol = atol if atol is not lib.no_default else 1.0e-8
777
+
778
+ assert isinstance(left, ExtensionArray), "left is not an ExtensionArray"
779
+ assert isinstance(right, ExtensionArray), "right is not an ExtensionArray"
780
+ if check_dtype:
781
+ assert_attr_equal("dtype", left, right, obj=f"Attributes of {obj}")
782
+
783
+ if (
784
+ isinstance(left, DatetimeLikeArrayMixin)
785
+ and isinstance(right, DatetimeLikeArrayMixin)
786
+ and type(right) == type(left)
787
+ ):
788
+ # GH 52449
789
+ if not check_dtype and left.dtype.kind in "mM":
790
+ if not isinstance(left.dtype, np.dtype):
791
+ l_unit = cast(DatetimeTZDtype, left.dtype).unit
792
+ else:
793
+ l_unit = np.datetime_data(left.dtype)[0]
794
+ if not isinstance(right.dtype, np.dtype):
795
+ r_unit = cast(DatetimeTZDtype, right.dtype).unit
796
+ else:
797
+ r_unit = np.datetime_data(right.dtype)[0]
798
+ if (
799
+ l_unit != r_unit
800
+ and compare_mismatched_resolutions(
801
+ left._ndarray, right._ndarray, operator.eq
802
+ ).all()
803
+ ):
804
+ return
805
+ # Avoid slow object-dtype comparisons
806
+ # np.asarray for case where we have an np.MaskedArray
807
+ assert_numpy_array_equal(
808
+ np.asarray(left.asi8),
809
+ np.asarray(right.asi8),
810
+ index_values=index_values,
811
+ obj=obj,
812
+ )
813
+ return
814
+
815
+ left_na = np.asarray(left.isna())
816
+ right_na = np.asarray(right.isna())
817
+ assert_numpy_array_equal(
818
+ left_na, right_na, obj=f"{obj} NA mask", index_values=index_values
819
+ )
820
+
821
+ # Specifically for StringArrayNumpySemantics, validate here we have a valid array
822
+ if (
823
+ isinstance(left.dtype, StringDtype)
824
+ and left.dtype.storage == "python"
825
+ and left.dtype.na_value is np.nan
826
+ ):
827
+ assert np.all(
828
+ [np.isnan(val) for val in left._ndarray[left_na]] # type: ignore[attr-defined]
829
+ ), "wrong missing value sentinels"
830
+ if (
831
+ isinstance(right.dtype, StringDtype)
832
+ and right.dtype.storage == "python"
833
+ and right.dtype.na_value is np.nan
834
+ ):
835
+ assert np.all(
836
+ [np.isnan(val) for val in right._ndarray[right_na]] # type: ignore[attr-defined]
837
+ ), "wrong missing value sentinels"
838
+
839
+ left_valid = left[~left_na].to_numpy(dtype=object)
840
+ right_valid = right[~right_na].to_numpy(dtype=object)
841
+ if check_exact:
842
+ assert_numpy_array_equal(
843
+ left_valid, right_valid, obj=obj, index_values=index_values
844
+ )
845
+ else:
846
+ _testing.assert_almost_equal(
847
+ left_valid,
848
+ right_valid,
849
+ check_dtype=bool(check_dtype),
850
+ rtol=rtol,
851
+ atol=atol,
852
+ obj=obj,
853
+ index_values=index_values,
854
+ )
855
+
856
+
857
+ # This could be refactored to use the NDFrame.equals method
858
+ @set_module("pandas.testing")
859
+ @deprecate_kwarg(Pandas4Warning, "check_datetimelike_compat", new_arg_name=None)
860
+ def assert_series_equal(
861
+ left,
862
+ right,
863
+ check_dtype: bool | Literal["equiv"] = True,
864
+ check_index_type: bool | Literal["equiv"] = "equiv",
865
+ check_series_type: bool = True,
866
+ check_names: bool = True,
867
+ check_exact: bool | lib.NoDefault = lib.no_default,
868
+ check_datetimelike_compat: bool = False,
869
+ check_categorical: bool = True,
870
+ check_category_order: bool = True,
871
+ check_freq: bool = True,
872
+ check_flags: bool = True,
873
+ rtol: float | lib.NoDefault = lib.no_default,
874
+ atol: float | lib.NoDefault = lib.no_default,
875
+ obj: str = "Series",
876
+ *,
877
+ check_index: bool = True,
878
+ check_like: bool = False,
879
+ ) -> None:
880
+ """
881
+ Check that left and right Series are equal.
882
+
883
+ Parameters
884
+ ----------
885
+ left : Series
886
+ First Series to compare.
887
+ right : Series
888
+ Second Series to compare.
889
+ check_dtype : bool, default True
890
+ Whether to check the Series dtype is identical.
891
+ check_index_type : bool or {'equiv'}, default 'equiv'
892
+ Whether to check the Index class, dtype and inferred_type
893
+ are identical.
894
+ check_series_type : bool, default True
895
+ Whether to check the Series class is identical.
896
+ check_names : bool, default True
897
+ Whether to check the Series and Index names attribute.
898
+ check_exact : bool, default False
899
+ Whether to compare number exactly. This also applies when checking
900
+ Index equivalence.
901
+
902
+ .. versionchanged:: 2.2.0
903
+
904
+ Defaults to True for integer dtypes if none of
905
+ ``check_exact``, ``rtol`` and ``atol`` are specified.
906
+
907
+ .. versionchanged:: 3.0.0
908
+
909
+ check_exact for comparing the Indexes defaults to True by
910
+ checking if an Index is of integer dtypes.
911
+
912
+ check_datetimelike_compat : bool, default False
913
+ Compare datetime-like which is comparable ignoring dtype.
914
+
915
+ .. deprecated:: 3.0
916
+
917
+ check_categorical : bool, default True
918
+ Whether to compare internal Categorical exactly.
919
+ check_category_order : bool, default True
920
+ Whether to compare category order of internal Categoricals.
921
+ check_freq : bool, default True
922
+ Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
923
+ check_flags : bool, default True
924
+ Whether to check the `flags` attribute.
925
+ rtol : float, default 1e-5
926
+ Relative tolerance. Only used when check_exact is False.
927
+ atol : float, default 1e-8
928
+ Absolute tolerance. Only used when check_exact is False.
929
+ obj : str, default 'Series'
930
+ Specify object name being compared, internally used to show appropriate
931
+ assertion message.
932
+ check_index : bool, default True
933
+ Whether to check index equivalence. If False, then compare only values.
934
+ check_like : bool, default False
935
+ If True, ignore the order of the index. Must be False if check_index is False.
936
+ Note: same labels must be with the same data.
937
+
938
+ See Also
939
+ --------
940
+ testing.assert_index_equal : Check that two Indexes are equal.
941
+ testing.assert_frame_equal : Check that two DataFrames are equal.
942
+
943
+ Examples
944
+ --------
945
+ >>> from pandas import testing as tm
946
+ >>> a = pd.Series([1, 2, 3, 4])
947
+ >>> b = pd.Series([1, 2, 3, 4])
948
+ >>> tm.assert_series_equal(a, b)
949
+ """
950
+ __tracebackhide__ = True
951
+ if (
952
+ check_exact is lib.no_default
953
+ and rtol is lib.no_default
954
+ and atol is lib.no_default
955
+ ):
956
+ check_exact = (
957
+ is_numeric_dtype(left.dtype) and not is_float_dtype(left.dtype)
958
+ ) or (is_numeric_dtype(right.dtype) and not is_float_dtype(right.dtype))
959
+ left_index_dtypes = (
960
+ [left.index.dtype] if left.index.nlevels == 1 else left.index.dtypes
961
+ )
962
+ right_index_dtypes = (
963
+ [right.index.dtype] if right.index.nlevels == 1 else right.index.dtypes
964
+ )
965
+ check_exact_index = all(
966
+ dtype.kind in "iu" for dtype in left_index_dtypes
967
+ ) or all(dtype.kind in "iu" for dtype in right_index_dtypes)
968
+ elif check_exact is lib.no_default:
969
+ check_exact = False
970
+ check_exact_index = False
971
+ else:
972
+ check_exact_index = check_exact
973
+
974
+ rtol = rtol if rtol is not lib.no_default else 1.0e-5
975
+ atol = atol if atol is not lib.no_default else 1.0e-8
976
+
977
+ if not check_index and check_like:
978
+ raise ValueError("check_like must be False if check_index is False")
979
+
980
+ # instance validation
981
+ _check_isinstance(left, right, Series)
982
+
983
+ if check_series_type:
984
+ assert_class_equal(left, right, obj=obj)
985
+
986
+ # length comparison
987
+ if len(left) != len(right):
988
+ msg1 = f"{len(left)}, {left.index}"
989
+ msg2 = f"{len(right)}, {right.index}"
990
+ raise_assert_detail(obj, "Series length are different", msg1, msg2)
991
+
992
+ if check_flags:
993
+ assert left.flags == right.flags, f"{left.flags!r} != {right.flags!r}"
994
+
995
+ if check_index:
996
+ # GH #38183
997
+ assert_index_equal(
998
+ left.index,
999
+ right.index,
1000
+ exact=check_index_type,
1001
+ check_names=check_names,
1002
+ check_exact=check_exact_index,
1003
+ check_categorical=check_categorical,
1004
+ check_order=not check_like,
1005
+ rtol=rtol,
1006
+ atol=atol,
1007
+ obj=f"{obj}.index",
1008
+ )
1009
+
1010
+ if check_like:
1011
+ left = left.reindex_like(right)
1012
+
1013
+ if check_freq and isinstance(left.index, (DatetimeIndex, TimedeltaIndex)):
1014
+ lidx = left.index
1015
+ ridx = right.index
1016
+ assert lidx.freq == ridx.freq, (lidx.freq, ridx.freq)
1017
+
1018
+ if check_dtype:
1019
+ # We want to skip exact dtype checking when `check_categorical`
1020
+ # is False. We'll still raise if only one is a `Categorical`,
1021
+ # regardless of `check_categorical`
1022
+ if (
1023
+ isinstance(left.dtype, CategoricalDtype)
1024
+ and isinstance(right.dtype, CategoricalDtype)
1025
+ and not check_categorical
1026
+ ):
1027
+ pass
1028
+ else:
1029
+ assert_attr_equal("dtype", left, right, obj=f"Attributes of {obj}")
1030
+ if check_exact:
1031
+ left_values = left._values
1032
+ right_values = right._values
1033
+ # Only check exact if dtype is numeric
1034
+ if isinstance(left_values, ExtensionArray) and isinstance(
1035
+ right_values, ExtensionArray
1036
+ ):
1037
+ assert_extension_array_equal(
1038
+ left_values,
1039
+ right_values,
1040
+ check_dtype=check_dtype,
1041
+ index_values=left.index,
1042
+ obj=str(obj),
1043
+ )
1044
+ else:
1045
+ # convert both to NumPy if not, check_dtype would raise earlier
1046
+ lv, rv = left_values, right_values
1047
+ if isinstance(left_values, ExtensionArray):
1048
+ lv = left_values.to_numpy()
1049
+ if isinstance(right_values, ExtensionArray):
1050
+ rv = right_values.to_numpy()
1051
+ assert_numpy_array_equal(
1052
+ lv,
1053
+ rv,
1054
+ check_dtype=check_dtype,
1055
+ obj=str(obj),
1056
+ index_values=left.index,
1057
+ )
1058
+ elif check_datetimelike_compat and (
1059
+ needs_i8_conversion(left.dtype) or needs_i8_conversion(right.dtype)
1060
+ ):
1061
+ # we want to check only if we have compat dtypes
1062
+ # e.g. integer and M|m are NOT compat, but we can simply check
1063
+ # the values in that case
1064
+
1065
+ # datetimelike may have different objects (e.g. datetime.datetime
1066
+ # vs Timestamp) but will compare equal
1067
+ if not Index(left._values).equals(Index(right._values)):
1068
+ msg = (
1069
+ f"[datetimelike_compat=True] {left._values} "
1070
+ f"is not equal to {right._values}."
1071
+ )
1072
+ raise AssertionError(msg)
1073
+ elif isinstance(left.dtype, IntervalDtype) and isinstance(
1074
+ right.dtype, IntervalDtype
1075
+ ):
1076
+ assert_interval_array_equal(left.array, right.array)
1077
+ elif isinstance(left.dtype, CategoricalDtype) or isinstance(
1078
+ right.dtype, CategoricalDtype
1079
+ ):
1080
+ _testing.assert_almost_equal(
1081
+ left._values,
1082
+ right._values,
1083
+ rtol=rtol,
1084
+ atol=atol,
1085
+ check_dtype=bool(check_dtype),
1086
+ obj=str(obj),
1087
+ index_values=left.index,
1088
+ )
1089
+ elif isinstance(left.dtype, ExtensionDtype) and isinstance(
1090
+ right.dtype, ExtensionDtype
1091
+ ):
1092
+ assert_extension_array_equal(
1093
+ left._values,
1094
+ right._values,
1095
+ rtol=rtol,
1096
+ atol=atol,
1097
+ check_dtype=check_dtype,
1098
+ index_values=left.index,
1099
+ obj=str(obj),
1100
+ )
1101
+ elif is_extension_array_dtype_and_needs_i8_conversion(
1102
+ left.dtype, right.dtype
1103
+ ) or is_extension_array_dtype_and_needs_i8_conversion(right.dtype, left.dtype):
1104
+ assert_extension_array_equal(
1105
+ left._values,
1106
+ right._values,
1107
+ check_dtype=check_dtype,
1108
+ index_values=left.index,
1109
+ obj=str(obj),
1110
+ )
1111
+ elif needs_i8_conversion(left.dtype) and needs_i8_conversion(right.dtype):
1112
+ # DatetimeArray or TimedeltaArray
1113
+ assert_extension_array_equal(
1114
+ left._values,
1115
+ right._values,
1116
+ check_dtype=check_dtype,
1117
+ index_values=left.index,
1118
+ obj=str(obj),
1119
+ )
1120
+ else:
1121
+ _testing.assert_almost_equal(
1122
+ left._values,
1123
+ right._values,
1124
+ rtol=rtol,
1125
+ atol=atol,
1126
+ check_dtype=bool(check_dtype),
1127
+ obj=str(obj),
1128
+ index_values=left.index,
1129
+ )
1130
+
1131
+ # metadata comparison
1132
+ if check_names:
1133
+ assert_attr_equal("name", left, right, obj=obj)
1134
+
1135
+ if check_categorical:
1136
+ if isinstance(left.dtype, CategoricalDtype) or isinstance(
1137
+ right.dtype, CategoricalDtype
1138
+ ):
1139
+ assert_categorical_equal(
1140
+ left._values,
1141
+ right._values,
1142
+ obj=f"{obj} category",
1143
+ check_category_order=check_category_order,
1144
+ )
1145
+
1146
+
1147
+ # This could be refactored to use the NDFrame.equals method
1148
+ @set_module("pandas.testing")
1149
+ @deprecate_kwarg(Pandas4Warning, "check_datetimelike_compat", new_arg_name=None)
1150
+ def assert_frame_equal(
1151
+ left,
1152
+ right,
1153
+ check_dtype: bool | Literal["equiv"] = True,
1154
+ check_index_type: bool | Literal["equiv"] = "equiv",
1155
+ check_column_type: bool | Literal["equiv"] = "equiv",
1156
+ check_frame_type: bool = True,
1157
+ check_names: bool = True,
1158
+ by_blocks: bool = False,
1159
+ check_exact: bool | lib.NoDefault = lib.no_default,
1160
+ check_datetimelike_compat: bool = False,
1161
+ check_categorical: bool = True,
1162
+ check_like: bool = False,
1163
+ check_freq: bool = True,
1164
+ check_flags: bool = True,
1165
+ rtol: float | lib.NoDefault = lib.no_default,
1166
+ atol: float | lib.NoDefault = lib.no_default,
1167
+ obj: str = "DataFrame",
1168
+ ) -> None:
1169
+ """
1170
+ Check that left and right DataFrame are equal.
1171
+
1172
+ This function is intended to compare two DataFrames and output any
1173
+ differences. It is mostly intended for use in unit tests.
1174
+ Additional parameters allow varying the strictness of the
1175
+ equality checks performed.
1176
+
1177
+ Parameters
1178
+ ----------
1179
+ left : DataFrame
1180
+ First DataFrame to compare.
1181
+ right : DataFrame
1182
+ Second DataFrame to compare.
1183
+ check_dtype : bool, default True
1184
+ Whether to check the DataFrame dtype is identical.
1185
+ check_index_type : bool or {'equiv'}, default 'equiv'
1186
+ Whether to check the Index class, dtype and inferred_type
1187
+ are identical.
1188
+ check_column_type : bool or {'equiv'}, default 'equiv'
1189
+ Whether to check the columns class, dtype and inferred_type
1190
+ are identical. Is passed as the ``exact`` argument of
1191
+ :func:`assert_index_equal`.
1192
+ check_frame_type : bool, default True
1193
+ Whether to check the DataFrame class is identical.
1194
+ check_names : bool, default True
1195
+ Whether to check that the `names` attribute for both the `index`
1196
+ and `column` attributes of the DataFrame is identical.
1197
+ by_blocks : bool, default False
1198
+ Specify how to compare internal data. If False, compare by columns.
1199
+ If True, compare by blocks.
1200
+ check_exact : bool, default False
1201
+ Whether to compare number exactly. If False, the comparison uses the
1202
+ relative tolerance (``rtol``) and absolute tolerance (``atol``)
1203
+ parameters to determine if two values are considered close,
1204
+ according to the formula: ``|a - b| <= (atol + rtol * |b|)``.
1205
+
1206
+ .. versionchanged:: 2.2.0
1207
+
1208
+ Defaults to True for integer dtypes if none of
1209
+ ``check_exact``, ``rtol`` and ``atol`` are specified.
1210
+ check_datetimelike_compat : bool, default False
1211
+ Compare datetime-like which is comparable ignoring dtype.
1212
+
1213
+ .. deprecated:: 3.0
1214
+
1215
+ check_categorical : bool, default True
1216
+ Whether to compare internal Categorical exactly.
1217
+ check_like : bool, default False
1218
+ If True, ignore the order of index & columns.
1219
+ Note: index labels must match their respective rows
1220
+ (same as in columns) - same labels must be with the same data.
1221
+ check_freq : bool, default True
1222
+ Whether to check the `freq` attribute on a DatetimeIndex or TimedeltaIndex.
1223
+ check_flags : bool, default True
1224
+ Whether to check the `flags` attribute.
1225
+ rtol : float, default 1e-5
1226
+ Relative tolerance. Only used when check_exact is False.
1227
+ atol : float, default 1e-8
1228
+ Absolute tolerance. Only used when check_exact is False.
1229
+ obj : str, default 'DataFrame'
1230
+ Specify object name being compared, internally used to show appropriate
1231
+ assertion message.
1232
+
1233
+ See Also
1234
+ --------
1235
+ assert_series_equal : Equivalent method for asserting Series equality.
1236
+ DataFrame.equals : Check DataFrame equality.
1237
+
1238
+ Examples
1239
+ --------
1240
+ This example shows comparing two DataFrames that are equal
1241
+ but with columns of differing dtypes.
1242
+
1243
+ >>> from pandas.testing import assert_frame_equal
1244
+ >>> df1 = pd.DataFrame({"a": [1, 2], "b": [3, 4]})
1245
+ >>> df2 = pd.DataFrame({"a": [1, 2], "b": [3.0, 4.0]})
1246
+
1247
+ df1 equals itself.
1248
+
1249
+ >>> assert_frame_equal(df1, df1)
1250
+
1251
+ df1 differs from df2 as column 'b' is of a different type.
1252
+
1253
+ >>> assert_frame_equal(df1, df2)
1254
+ Traceback (most recent call last):
1255
+ ...
1256
+ AssertionError: Attributes of DataFrame.iloc[:, 1] (column name="b") are different
1257
+
1258
+ Attribute "dtype" are different
1259
+ [left]: int64
1260
+ [right]: float64
1261
+
1262
+ Ignore differing dtypes in columns with check_dtype.
1263
+
1264
+ >>> assert_frame_equal(df1, df2, check_dtype=False)
1265
+ """
1266
+ __tracebackhide__ = True
1267
+ _rtol = rtol if rtol is not lib.no_default else 1.0e-5
1268
+ _atol = atol if atol is not lib.no_default else 1.0e-8
1269
+ _check_exact = check_exact if check_exact is not lib.no_default else False
1270
+
1271
+ # instance validation
1272
+ _check_isinstance(left, right, DataFrame)
1273
+
1274
+ if check_frame_type:
1275
+ assert isinstance(left, type(right))
1276
+ # assert_class_equal(left, right, obj=obj)
1277
+
1278
+ # shape comparison
1279
+ if left.shape != right.shape:
1280
+ raise_assert_detail(
1281
+ obj, f"{obj} shape mismatch", f"{left.shape!r}", f"{right.shape!r}"
1282
+ )
1283
+
1284
+ if check_flags:
1285
+ assert left.flags == right.flags, f"{left.flags!r} != {right.flags!r}"
1286
+
1287
+ # index comparison
1288
+ assert_index_equal(
1289
+ left.index,
1290
+ right.index,
1291
+ exact=check_index_type,
1292
+ check_names=check_names,
1293
+ check_exact=_check_exact,
1294
+ check_categorical=check_categorical,
1295
+ check_order=not check_like,
1296
+ rtol=_rtol,
1297
+ atol=_atol,
1298
+ obj=f"{obj}.index",
1299
+ )
1300
+
1301
+ # column comparison
1302
+ assert_index_equal(
1303
+ left.columns,
1304
+ right.columns,
1305
+ exact=check_column_type,
1306
+ check_names=check_names,
1307
+ check_exact=_check_exact,
1308
+ check_categorical=check_categorical,
1309
+ check_order=not check_like,
1310
+ rtol=_rtol,
1311
+ atol=_atol,
1312
+ obj=f"{obj}.columns",
1313
+ )
1314
+
1315
+ if check_like:
1316
+ left = left.reindex_like(right)
1317
+
1318
+ # compare by blocks
1319
+ if by_blocks:
1320
+ rblocks = right._to_dict_of_blocks()
1321
+ lblocks = left._to_dict_of_blocks()
1322
+ for dtype in list(set(list(lblocks.keys()) + list(rblocks.keys()))):
1323
+ assert dtype in lblocks
1324
+ assert dtype in rblocks
1325
+ assert_frame_equal(
1326
+ lblocks[dtype], rblocks[dtype], check_dtype=check_dtype, obj=obj
1327
+ )
1328
+
1329
+ # compare by columns
1330
+ else:
1331
+ for i, col in enumerate(left.columns):
1332
+ # We have already checked that columns match, so we can do
1333
+ # fast location-based lookups
1334
+ lcol = left._ixs(i, axis=1)
1335
+ rcol = right._ixs(i, axis=1)
1336
+
1337
+ # GH #38183
1338
+ # use check_index=False, because we do not want to run
1339
+ # assert_index_equal for each column,
1340
+ # as we already checked it for the whole dataframe before.
1341
+ with warnings.catch_warnings():
1342
+ warnings.filterwarnings(
1343
+ "ignore",
1344
+ message="the 'check_datetimelike_compat' keyword",
1345
+ category=Pandas4Warning,
1346
+ )
1347
+ assert_series_equal(
1348
+ lcol,
1349
+ rcol,
1350
+ check_dtype=check_dtype,
1351
+ check_index_type=check_index_type,
1352
+ check_exact=check_exact,
1353
+ check_names=check_names,
1354
+ check_datetimelike_compat=check_datetimelike_compat,
1355
+ check_categorical=check_categorical,
1356
+ check_freq=check_freq,
1357
+ obj=f'{obj}.iloc[:, {i}] (column name="{col}")',
1358
+ rtol=rtol,
1359
+ atol=atol,
1360
+ check_index=False,
1361
+ check_flags=False,
1362
+ )
1363
+
1364
+
1365
+ def assert_equal(left, right, **kwargs) -> None:
1366
+ """
1367
+ Wrapper for tm.assert_*_equal to dispatch to the appropriate test function.
1368
+
1369
+ Parameters
1370
+ ----------
1371
+ left, right : Index, Series, DataFrame, ExtensionArray, or np.ndarray
1372
+ The two items to be compared.
1373
+ **kwargs
1374
+ All keyword arguments are passed through to the underlying assert method.
1375
+ """
1376
+ __tracebackhide__ = True
1377
+
1378
+ if isinstance(left, Index):
1379
+ assert_index_equal(left, right, **kwargs)
1380
+ if isinstance(left, (DatetimeIndex, TimedeltaIndex)):
1381
+ assert left.freq == right.freq, (left.freq, right.freq)
1382
+ elif isinstance(left, Series):
1383
+ assert_series_equal(left, right, **kwargs)
1384
+ elif isinstance(left, DataFrame):
1385
+ assert_frame_equal(left, right, **kwargs)
1386
+ elif isinstance(left, IntervalArray):
1387
+ assert_interval_array_equal(left, right, **kwargs)
1388
+ elif isinstance(left, PeriodArray):
1389
+ assert_period_array_equal(left, right, **kwargs)
1390
+ elif isinstance(left, DatetimeArray):
1391
+ assert_datetime_array_equal(left, right, **kwargs)
1392
+ elif isinstance(left, TimedeltaArray):
1393
+ assert_timedelta_array_equal(left, right, **kwargs)
1394
+ elif isinstance(left, ExtensionArray):
1395
+ assert_extension_array_equal(left, right, **kwargs)
1396
+ elif isinstance(left, np.ndarray):
1397
+ assert_numpy_array_equal(left, right, **kwargs)
1398
+ elif isinstance(left, str):
1399
+ assert kwargs == {}
1400
+ assert left == right
1401
+ else:
1402
+ assert kwargs == {}
1403
+ assert_almost_equal(left, right)
1404
+
1405
+
1406
+ def assert_sp_array_equal(left, right) -> None:
1407
+ """
1408
+ Check that the left and right SparseArray are equal.
1409
+
1410
+ Parameters
1411
+ ----------
1412
+ left : SparseArray
1413
+ right : SparseArray
1414
+ """
1415
+ _check_isinstance(left, right, pd.arrays.SparseArray)
1416
+
1417
+ assert_numpy_array_equal(left.sp_values, right.sp_values)
1418
+
1419
+ # SparseIndex comparison
1420
+ assert isinstance(left.sp_index, SparseIndex)
1421
+ assert isinstance(right.sp_index, SparseIndex)
1422
+
1423
+ left_index = left.sp_index
1424
+ right_index = right.sp_index
1425
+
1426
+ if not left_index.equals(right_index):
1427
+ raise_assert_detail(
1428
+ "SparseArray.index", "index are not equal", left_index, right_index
1429
+ )
1430
+ else:
1431
+ # Just ensure a
1432
+ pass
1433
+
1434
+ assert_attr_equal("fill_value", left, right)
1435
+ assert_attr_equal("dtype", left, right)
1436
+ assert_numpy_array_equal(left.to_dense(), right.to_dense())
1437
+
1438
+
1439
+ def assert_contains_all(iterable, dic) -> None:
1440
+ for k in iterable:
1441
+ assert k in dic, f"Did not contain item: {k!r}"
1442
+
1443
+
1444
+ def assert_copy(iter1, iter2, **eql_kwargs) -> None:
1445
+ """
1446
+ iter1, iter2: iterables that produce elements
1447
+ comparable with assert_almost_equal
1448
+
1449
+ Checks that the elements are equal, but not
1450
+ the same object. (Does not check that items
1451
+ in sequences are also not the same object)
1452
+ """
1453
+ for elem1, elem2 in zip(iter1, iter2, strict=True):
1454
+ assert_almost_equal(elem1, elem2, **eql_kwargs)
1455
+ msg = (
1456
+ f"Expected object {type(elem1)!r} and object {type(elem2)!r} to be "
1457
+ "different objects, but they were the same object."
1458
+ )
1459
+ assert elem1 is not elem2, msg
1460
+
1461
+
1462
+ def is_extension_array_dtype_and_needs_i8_conversion(
1463
+ left_dtype: DtypeObj, right_dtype: DtypeObj
1464
+ ) -> bool:
1465
+ """
1466
+ Checks that we have the combination of an ExtensionArraydtype and
1467
+ a dtype that should be converted to int64
1468
+
1469
+ Returns
1470
+ -------
1471
+ bool
1472
+
1473
+ Related to issue #37609
1474
+ """
1475
+ return isinstance(left_dtype, ExtensionDtype) and needs_i8_conversion(right_dtype)
1476
+
1477
+
1478
+ def assert_indexing_slices_equivalent(ser: Series, l_slc: slice, i_slc: slice) -> None:
1479
+ """
1480
+ Check that ser.iloc[i_slc] matches ser.loc[l_slc] and, if applicable,
1481
+ ser[l_slc].
1482
+ """
1483
+ expected = ser.iloc[i_slc]
1484
+
1485
+ assert_series_equal(ser.loc[l_slc], expected)
1486
+
1487
+ if not is_integer_dtype(ser.index):
1488
+ # For integer indices, .loc and plain getitem are position-based.
1489
+ assert_series_equal(ser[l_slc], expected)
1490
+
1491
+
1492
+ def assert_metadata_equivalent(
1493
+ left: DataFrame | Series, right: DataFrame | Series | None = None
1494
+ ) -> None:
1495
+ """
1496
+ Check that ._metadata attributes are equivalent.
1497
+ """
1498
+ for attr in left._metadata:
1499
+ val = getattr(left, attr, None)
1500
+ if right is None:
1501
+ assert val is None
1502
+ else:
1503
+ assert val == getattr(right, attr, None)
.venv/lib/python3.11/site-packages/pandas/_testing/compat.py ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Helpers for sharing tests between DataFrame/Series
3
+ """
4
+
5
+ from __future__ import annotations
6
+
7
+ from typing import TYPE_CHECKING
8
+
9
+ from pandas import DataFrame
10
+
11
+ if TYPE_CHECKING:
12
+ from pandas._typing import DtypeObj
13
+
14
+
15
+ def get_dtype(obj) -> DtypeObj:
16
+ if isinstance(obj, DataFrame):
17
+ # Note: we are assuming only one column
18
+ return obj.dtypes.iat[0]
19
+ else:
20
+ return obj.dtype
21
+
22
+
23
+ def get_obj(df: DataFrame, klass):
24
+ """
25
+ For sharing tests using frame_or_series, either return the DataFrame
26
+ unchanged or return it's first column as a Series.
27
+ """
28
+ if klass is DataFrame:
29
+ return df
30
+ return df._ixs(0, axis=1)
.venv/lib/python3.11/site-packages/pandas/_testing/contexts.py ADDED
@@ -0,0 +1,151 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from contextlib import contextmanager
4
+ import os
5
+ import sys
6
+ from typing import (
7
+ IO,
8
+ TYPE_CHECKING,
9
+ )
10
+
11
+ from pandas.compat import CHAINED_WARNING_DISABLED
12
+ from pandas.errors import ChainedAssignmentError
13
+
14
+ from pandas.io.common import get_handle
15
+
16
+ if TYPE_CHECKING:
17
+ from collections.abc import Generator
18
+
19
+ from pandas._typing import (
20
+ BaseBuffer,
21
+ CompressionOptions,
22
+ FilePath,
23
+ )
24
+
25
+
26
+ @contextmanager
27
+ def decompress_file(
28
+ path: FilePath | BaseBuffer, compression: CompressionOptions
29
+ ) -> Generator[IO[bytes]]:
30
+ """
31
+ Open a compressed file and return a file object.
32
+
33
+ Parameters
34
+ ----------
35
+ path : str
36
+ The path where the file is read from.
37
+
38
+ compression : {'gzip', 'bz2', 'zip', 'xz', 'zstd', None}
39
+ Name of the decompression to use
40
+
41
+ Returns
42
+ -------
43
+ file object
44
+ """
45
+ with get_handle(path, "rb", compression=compression, is_text=False) as handle:
46
+ yield handle.handle
47
+
48
+
49
+ @contextmanager
50
+ def set_timezone(tz: str) -> Generator[None]:
51
+ """
52
+ Context manager for temporarily setting a timezone.
53
+
54
+ Parameters
55
+ ----------
56
+ tz : str
57
+ A string representing a valid timezone.
58
+
59
+ Examples
60
+ --------
61
+ >>> from datetime import datetime
62
+ >>> from dateutil.tz import tzlocal
63
+ >>> tzlocal().tzname(datetime(2021, 1, 1)) # doctest: +SKIP
64
+ 'IST'
65
+
66
+ >>> with set_timezone("US/Eastern"):
67
+ ... tzlocal().tzname(datetime(2021, 1, 1))
68
+ 'EST'
69
+ """
70
+ import time
71
+
72
+ def setTZ(tz) -> None:
73
+ if hasattr(time, "tzset"):
74
+ if tz is None:
75
+ try:
76
+ del os.environ["TZ"]
77
+ except KeyError:
78
+ pass
79
+ else:
80
+ os.environ["TZ"] = tz
81
+ # Next line allows typing checks to pass on Windows
82
+ if sys.platform != "win32":
83
+ time.tzset()
84
+
85
+ orig_tz = os.environ.get("TZ")
86
+ setTZ(tz)
87
+ try:
88
+ yield
89
+ finally:
90
+ setTZ(orig_tz)
91
+
92
+
93
+ @contextmanager
94
+ def with_csv_dialect(name: str, **kwargs) -> Generator[None]:
95
+ """
96
+ Context manager to temporarily register a CSV dialect for parsing CSV.
97
+
98
+ Parameters
99
+ ----------
100
+ name : str
101
+ The name of the dialect.
102
+ kwargs : mapping
103
+ The parameters for the dialect.
104
+
105
+ Raises
106
+ ------
107
+ ValueError : the name of the dialect conflicts with a builtin one.
108
+
109
+ See Also
110
+ --------
111
+ csv : Python's CSV library.
112
+ """
113
+ import csv
114
+
115
+ _BUILTIN_DIALECTS = {"excel", "excel-tab", "unix"}
116
+
117
+ if name in _BUILTIN_DIALECTS:
118
+ raise ValueError("Cannot override builtin dialect.")
119
+
120
+ csv.register_dialect(name, **kwargs)
121
+ try:
122
+ yield
123
+ finally:
124
+ csv.unregister_dialect(name)
125
+
126
+
127
+ def raises_chained_assignment_error(extra_warnings=(), extra_match=()):
128
+ from pandas._testing import assert_produces_warning
129
+
130
+ if CHAINED_WARNING_DISABLED:
131
+ if not extra_warnings:
132
+ from contextlib import nullcontext
133
+
134
+ return nullcontext()
135
+ else:
136
+ return assert_produces_warning(
137
+ extra_warnings,
138
+ match=extra_match,
139
+ )
140
+ else:
141
+ warning = ChainedAssignmentError
142
+ match = (
143
+ "A value is being set on a copy of a DataFrame or Series "
144
+ "through chained assignment"
145
+ )
146
+ if extra_warnings:
147
+ warning = (warning, *extra_warnings) # type: ignore[assignment]
148
+ return assert_produces_warning(
149
+ warning,
150
+ match=(match, *extra_match),
151
+ )
.venv/lib/python3.11/site-packages/pandas/_typing.py ADDED
@@ -0,0 +1,578 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from __future__ import annotations
2
+
3
+ from builtins import type as type_t # pyright: ignore[reportUnusedImport]
4
+ from collections.abc import (
5
+ Callable,
6
+ Hashable,
7
+ Iterator,
8
+ Mapping,
9
+ MutableMapping,
10
+ Sequence,
11
+ )
12
+ from datetime import (
13
+ date,
14
+ datetime,
15
+ timedelta,
16
+ tzinfo,
17
+ )
18
+ from os import PathLike
19
+ from typing import (
20
+ TYPE_CHECKING,
21
+ Any,
22
+ Literal,
23
+ ParamSpec,
24
+ Protocol,
25
+ SupportsIndex,
26
+ TypeAlias,
27
+ TypeVar,
28
+ Union,
29
+ overload,
30
+ )
31
+
32
+ import numpy as np
33
+ import numpy.typing as npt
34
+
35
+ # To prevent import cycles place any internal imports in the branch below
36
+ # and use a string literal forward reference to it in subsequent types
37
+ # https://mypy.readthedocs.io/en/latest/common_issues.html#import-cycles
38
+
39
+ # Note that Union is needed when a Union includes a pandas type
40
+
41
+ if TYPE_CHECKING:
42
+ from pandas._libs import (
43
+ NaTType,
44
+ Period,
45
+ Timedelta,
46
+ Timestamp,
47
+ )
48
+ from pandas._libs.tslibs import BaseOffset
49
+
50
+ from pandas.core.dtypes.dtypes import ExtensionDtype
51
+
52
+ from pandas import (
53
+ DatetimeIndex,
54
+ Interval,
55
+ PeriodIndex,
56
+ TimedeltaIndex,
57
+ )
58
+ from pandas.arrays import (
59
+ DatetimeArray,
60
+ TimedeltaArray,
61
+ )
62
+ from pandas.core.arrays.base import ExtensionArray
63
+ from pandas.core.frame import DataFrame
64
+ from pandas.core.generic import NDFrame
65
+ from pandas.core.groupby.generic import (
66
+ DataFrameGroupBy,
67
+ GroupBy,
68
+ SeriesGroupBy,
69
+ )
70
+ from pandas.core.indexes.base import Index
71
+ from pandas.core.internals import (
72
+ BlockManager,
73
+ SingleBlockManager,
74
+ )
75
+ from pandas.core.resample import Resampler
76
+ from pandas.core.series import Series
77
+ from pandas.core.window.rolling import BaseWindow
78
+
79
+ from pandas.io.formats.format import EngFormatter
80
+ from pandas.tseries.holiday import AbstractHolidayCalendar
81
+
82
+ ScalarLike_co: TypeAlias = int | float | complex | str | bytes | np.generic
83
+
84
+ # numpy compatible types
85
+ NumpyValueArrayLike: TypeAlias = ScalarLike_co | npt.ArrayLike
86
+ NumpySorter: TypeAlias = npt.NDArray[np.integer] | None
87
+
88
+
89
+ P = ParamSpec("P")
90
+
91
+ HashableT = TypeVar("HashableT", bound=Hashable)
92
+ HashableT2 = TypeVar("HashableT2", bound=Hashable)
93
+ MutableMappingT = TypeVar("MutableMappingT", bound=MutableMapping)
94
+
95
+ # array-like
96
+
97
+ ArrayLike: TypeAlias = Union["ExtensionArray", np.ndarray]
98
+ ArrayLikeT = TypeVar("ArrayLikeT", "ExtensionArray", np.ndarray)
99
+ AnyArrayLike: TypeAlias = Union[ArrayLike, "Index", "Series"]
100
+ TimeArrayLike: TypeAlias = Union["DatetimeArray", "TimedeltaArray"]
101
+
102
+ # list-like
103
+
104
+ # from https://github.com/hauntsaninja/useful_types
105
+ # includes Sequence-like objects but excludes str and bytes
106
+ _T_co = TypeVar("_T_co", covariant=True)
107
+
108
+
109
+ class SequenceNotStr(Protocol[_T_co]):
110
+ __module__: str = "pandas.api.typing.aliases"
111
+
112
+ @overload
113
+ def __getitem__(self, index: SupportsIndex, /) -> _T_co: ...
114
+
115
+ @overload
116
+ def __getitem__(self, index: slice, /) -> Sequence[_T_co]: ...
117
+
118
+ def __contains__(self, value: object, /) -> bool: ...
119
+
120
+ def __len__(self) -> int: ...
121
+
122
+ def __iter__(self) -> Iterator[_T_co]: ...
123
+
124
+ def index(self, value: Any, start: int = ..., stop: int = ..., /) -> int: ...
125
+
126
+ def count(self, value: Any, /) -> int: ...
127
+
128
+ def __reversed__(self) -> Iterator[_T_co]: ...
129
+
130
+
131
+ ListLike: TypeAlias = AnyArrayLike | SequenceNotStr | range
132
+
133
+ # scalars
134
+
135
+ PythonScalar: TypeAlias = str | float | bool
136
+ DatetimeLikeScalar: TypeAlias = Union["Period", "Timestamp", "Timedelta"]
137
+
138
+ # aligned with pandas-stubs - typical scalars found in Series. Explicitly leaves
139
+ # out object
140
+ _IndexIterScalar: TypeAlias = Union[
141
+ str,
142
+ bytes,
143
+ date,
144
+ datetime,
145
+ timedelta,
146
+ np.datetime64,
147
+ np.timedelta64,
148
+ bool,
149
+ int,
150
+ float,
151
+ "Timestamp",
152
+ "Timedelta",
153
+ ]
154
+ Scalar: TypeAlias = Union[
155
+ _IndexIterScalar, "Interval", complex, np.integer, np.floating, np.complexfloating
156
+ ]
157
+
158
+ IntStrT = TypeVar("IntStrT", bound=int | str)
159
+
160
+ # timestamp and timedelta convertible types
161
+
162
+ TimestampConvertibleTypes: TypeAlias = Union[
163
+ "Timestamp", date, np.datetime64, np.int64, float, str
164
+ ]
165
+ TimestampNonexistent: TypeAlias = (
166
+ Literal["shift_forward", "shift_backward", "NaT", "raise"] | timedelta
167
+ )
168
+
169
+ TimedeltaConvertibleTypes: TypeAlias = Union[
170
+ "Timedelta", timedelta, np.timedelta64, np.int64, float, str
171
+ ]
172
+ Timezone: TypeAlias = str | tzinfo
173
+
174
+ ToTimestampHow: TypeAlias = Literal["s", "e", "start", "end"]
175
+
176
+ # NDFrameT is stricter and ensures that the same subclass of NDFrame always is
177
+ # used. E.g. `def func(a: NDFrameT) -> NDFrameT: ...` means that if a
178
+ # Series is passed into a function, a Series is always returned and if a DataFrame is
179
+ # passed in, a DataFrame is always returned.
180
+ NDFrameT = TypeVar("NDFrameT", bound="NDFrame")
181
+
182
+ IndexT = TypeVar("IndexT", bound="Index")
183
+ FreqIndexT = TypeVar("FreqIndexT", "DatetimeIndex", "PeriodIndex", "TimedeltaIndex")
184
+ NumpyIndexT = TypeVar("NumpyIndexT", np.ndarray, "Index")
185
+
186
+ AxisInt: TypeAlias = int
187
+ Axis: TypeAlias = AxisInt | Literal["index", "columns", "rows"]
188
+ IndexLabel: TypeAlias = Hashable | Sequence[Hashable]
189
+ Level: TypeAlias = Hashable
190
+ Shape: TypeAlias = tuple[int, ...]
191
+ Suffixes: TypeAlias = Sequence[str | None]
192
+ Ordered: TypeAlias = bool | None
193
+ JSONSerializable: TypeAlias = PythonScalar | list | dict | None
194
+ Frequency: TypeAlias = Union[str, "BaseOffset"]
195
+ Axes: TypeAlias = ListLike
196
+
197
+ RandomState: TypeAlias = (
198
+ int
199
+ | np.ndarray
200
+ | np.random.Generator
201
+ | np.random.BitGenerator
202
+ | np.random.RandomState
203
+ )
204
+
205
+
206
+ # dtypes
207
+ NpDtype: TypeAlias = str | np.dtype | type[str | complex | bool | object]
208
+ Dtype: TypeAlias = Union["ExtensionDtype", NpDtype]
209
+ AstypeArg: TypeAlias = Union["ExtensionDtype", npt.DTypeLike]
210
+ # DtypeArg specifies all allowable dtypes in a functions its dtype argument
211
+ DtypeArg: TypeAlias = Dtype | Mapping[Hashable, Dtype]
212
+ DtypeObj: TypeAlias = Union[np.dtype, "ExtensionDtype"]
213
+
214
+ # converters
215
+ ConvertersArg: TypeAlias = dict[Hashable, Callable[[Dtype], Dtype]]
216
+
217
+ # parse_dates
218
+ ParseDatesArg: TypeAlias = (
219
+ bool | list[Hashable] | list[list[Hashable]] | dict[Hashable, list[Hashable]]
220
+ )
221
+
222
+ # For functions like rename that convert one label to another
223
+ Renamer: TypeAlias = Mapping[Any, Hashable] | Callable[[Any], Hashable]
224
+
225
+ # to maintain type information across generic functions and parametrization
226
+ T = TypeVar("T")
227
+
228
+ # used in decorators to preserve the signature of the function it decorates
229
+ # see https://mypy.readthedocs.io/en/stable/generics.html#declaring-decorators
230
+ FuncType: TypeAlias = Callable[..., Any]
231
+ F = TypeVar("F", bound=FuncType)
232
+ TypeT = TypeVar("TypeT", bound=type)
233
+
234
+ # types of vectorized key functions for DataFrame::sort_values and
235
+ # DataFrame::sort_index, among others
236
+ ValueKeyFunc: TypeAlias = Callable[["Series"], Union["Series", AnyArrayLike]] | None
237
+ IndexKeyFunc: TypeAlias = Callable[["Index"], Union["Index", AnyArrayLike]] | None
238
+
239
+ # types of `func` kwarg for DataFrame.aggregate and Series.aggregate
240
+ AggFuncTypeBase: TypeAlias = Callable | str
241
+ AggFuncTypeDict: TypeAlias = MutableMapping[
242
+ Hashable, AggFuncTypeBase | list[AggFuncTypeBase]
243
+ ]
244
+ AggFuncType: TypeAlias = AggFuncTypeBase | list[AggFuncTypeBase] | AggFuncTypeDict
245
+ AggObjType: TypeAlias = Union[
246
+ "Series",
247
+ "DataFrame",
248
+ "GroupBy",
249
+ "SeriesGroupBy",
250
+ "DataFrameGroupBy",
251
+ "BaseWindow",
252
+ "Resampler",
253
+ ]
254
+
255
+ PythonFuncType: TypeAlias = Callable[[Any], Any]
256
+
257
+ # filenames and file-like-objects
258
+ AnyStr_co = TypeVar("AnyStr_co", str, bytes, covariant=True)
259
+ AnyStr_contra = TypeVar("AnyStr_contra", str, bytes, contravariant=True)
260
+
261
+
262
+ class BaseBuffer(Protocol):
263
+ @property
264
+ def mode(self) -> str:
265
+ # for _get_filepath_or_buffer
266
+ ...
267
+
268
+ def seek(self, offset: int, whence: int = ..., /) -> int:
269
+ # with one argument: gzip.GzipFile, bz2.BZ2File
270
+ # with two arguments: zip.ZipFile, read_sas
271
+ ...
272
+
273
+ def seekable(self) -> bool:
274
+ # for bz2.BZ2File
275
+ ...
276
+
277
+ def tell(self) -> int:
278
+ # for zip.ZipFile, read_stata, to_stata
279
+ ...
280
+
281
+
282
+ class ReadBuffer(BaseBuffer, Protocol[AnyStr_co]):
283
+ __module__: str = "pandas.api.typing.aliases"
284
+
285
+ def read(self, n: int = ..., /) -> AnyStr_co:
286
+ # for BytesIOWrapper, gzip.GzipFile, bz2.BZ2File
287
+ ...
288
+
289
+
290
+ class WriteBuffer(BaseBuffer, Protocol[AnyStr_contra]):
291
+ __module__: str = "pandas.api.typing.aliases"
292
+
293
+ def write(self, b: AnyStr_contra, /) -> Any:
294
+ # for gzip.GzipFile, bz2.BZ2File
295
+ ...
296
+
297
+ def flush(self) -> Any:
298
+ # for gzip.GzipFile, bz2.BZ2File
299
+ ...
300
+
301
+
302
+ class ReadPickleBuffer(ReadBuffer[bytes], Protocol):
303
+ __module__: str = "pandas.api.typing.aliases"
304
+
305
+ def readline(self) -> bytes: ...
306
+
307
+
308
+ class WriteExcelBuffer(WriteBuffer[bytes], Protocol):
309
+ __module__: str = "pandas.api.typing.aliases"
310
+
311
+ def truncate(self, size: int | None = ..., /) -> int: ...
312
+
313
+
314
+ class ReadCsvBuffer(ReadBuffer[AnyStr_co], Protocol):
315
+ __module__: str = "pandas.api.typing.aliases"
316
+
317
+ def __iter__(self) -> Iterator[AnyStr_co]:
318
+ # for engine=python
319
+ ...
320
+
321
+ def fileno(self) -> int:
322
+ # for _MMapWrapper
323
+ ...
324
+
325
+ def readline(self) -> AnyStr_co:
326
+ # for engine=python
327
+ ...
328
+
329
+ @property
330
+ def closed(self) -> bool:
331
+ # for engine=pyarrow
332
+ ...
333
+
334
+
335
+ FilePath: TypeAlias = str | PathLike[str]
336
+
337
+ # for arbitrary kwargs passed during reading/writing files
338
+ StorageOptions: TypeAlias = dict[str, Any] | None
339
+
340
+ # compression keywords and compression
341
+ CompressionDict: TypeAlias = dict[str, Any]
342
+ CompressionOptions: TypeAlias = (
343
+ Literal["infer", "gzip", "bz2", "zip", "xz", "zstd", "tar"] | CompressionDict | None
344
+ )
345
+ ParquetCompressionOptions: TypeAlias = (
346
+ Literal["snappy", "gzip", "brotli", "lz4", "zstd"] | None
347
+ )
348
+
349
+ # types in DataFrameFormatter
350
+ FormattersType: TypeAlias = (
351
+ list[Callable] | tuple[Callable, ...] | Mapping[str | int, Callable]
352
+ )
353
+ ColspaceType: TypeAlias = Mapping[Hashable, str | int]
354
+ FloatFormatType: TypeAlias = Union[str, Callable, "EngFormatter"]
355
+ ColspaceArgType: TypeAlias = (
356
+ str | int | Sequence[str | int] | Mapping[Hashable, str | int]
357
+ )
358
+
359
+ # Arguments for fillna()
360
+ FillnaOptions: TypeAlias = Literal["backfill", "bfill", "ffill", "pad"]
361
+ InterpolateOptions: TypeAlias = Literal[
362
+ "linear",
363
+ "time",
364
+ "index",
365
+ "values",
366
+ "nearest",
367
+ "zero",
368
+ "slinear",
369
+ "quadratic",
370
+ "cubic",
371
+ "barycentric",
372
+ "polynomial",
373
+ "krogh",
374
+ "piecewise_polynomial",
375
+ "spline",
376
+ "pchip",
377
+ "akima",
378
+ "cubicspline",
379
+ "from_derivatives",
380
+ ]
381
+
382
+ # internals
383
+ Manager: TypeAlias = Union["BlockManager", "SingleBlockManager"]
384
+
385
+ # indexing
386
+ # PositionalIndexer -> valid 1D positional indexer, e.g. can pass
387
+ # to ndarray.__getitem__
388
+ # ScalarIndexer is for a single value as the index
389
+ # SequenceIndexer is for list like or slices (but not tuples)
390
+ # PositionalIndexerTuple is extends the PositionalIndexer for 2D arrays
391
+ # These are used in various __getitem__ overloads
392
+ # TODO(typing#684): add Ellipsis, see
393
+ # https://github.com/python/typing/issues/684#issuecomment-548203158
394
+ # https://bugs.python.org/issue41810
395
+ # Using List[int] here rather than Sequence[int] to disallow tuples.
396
+ ScalarIndexer: TypeAlias = int | np.integer
397
+ SequenceIndexer: TypeAlias = slice | list[int] | np.ndarray
398
+ PositionalIndexer: TypeAlias = ScalarIndexer | SequenceIndexer
399
+ PositionalIndexerTuple: TypeAlias = tuple[PositionalIndexer, PositionalIndexer]
400
+ PositionalIndexer2D: TypeAlias = PositionalIndexer | PositionalIndexerTuple
401
+ TakeIndexer: TypeAlias = Sequence[int] | Sequence[np.integer] | npt.NDArray[np.integer]
402
+
403
+ # Shared by functions such as drop and astype
404
+ IgnoreRaise: TypeAlias = Literal["ignore", "raise"]
405
+
406
+ # Windowing rank methods
407
+ WindowingRankType: TypeAlias = Literal["average", "min", "max"]
408
+
409
+ # read_csv engines
410
+ CSVEngine: TypeAlias = Literal["c", "python", "pyarrow", "python-fwf"]
411
+
412
+ # read_json engines
413
+ JSONEngine: TypeAlias = Literal["ujson", "pyarrow"]
414
+
415
+ # read_xml parsers
416
+ XMLParsers: TypeAlias = Literal["lxml", "etree"]
417
+
418
+ # read_html flavors
419
+ HTMLFlavors: TypeAlias = Literal["lxml", "html5lib", "bs4"]
420
+
421
+ # Interval closed type
422
+ IntervalLeftRight: TypeAlias = Literal["left", "right"]
423
+ IntervalClosedType: TypeAlias = IntervalLeftRight | Literal["both", "neither"]
424
+
425
+ # datetime and NaTType
426
+ DatetimeNaTType: TypeAlias = Union[datetime, "NaTType"]
427
+ DateTimeErrorChoices: TypeAlias = Literal["raise", "coerce"]
428
+
429
+ # sort_index
430
+ SortKind: TypeAlias = Literal["quicksort", "mergesort", "heapsort", "stable"]
431
+ NaPosition: TypeAlias = Literal["first", "last"]
432
+
433
+ # Arguments for nsmallest and nlargest
434
+ NsmallestNlargestKeep: TypeAlias = Literal["first", "last", "all"]
435
+
436
+ # quantile interpolation
437
+ QuantileInterpolation: TypeAlias = Literal[
438
+ "linear", "lower", "higher", "midpoint", "nearest"
439
+ ]
440
+
441
+ # plotting
442
+ PlottingOrientation: TypeAlias = Literal["horizontal", "vertical"]
443
+
444
+ # dropna
445
+ AnyAll: TypeAlias = Literal["any", "all"]
446
+
447
+ # merge
448
+ MergeHow: TypeAlias = Literal[
449
+ "left", "right", "inner", "outer", "cross", "left_anti", "right_anti"
450
+ ]
451
+ MergeValidate: TypeAlias = Literal[
452
+ "one_to_one",
453
+ "1:1",
454
+ "one_to_many",
455
+ "1:m",
456
+ "many_to_one",
457
+ "m:1",
458
+ "many_to_many",
459
+ "m:m",
460
+ ]
461
+
462
+ # join
463
+ JoinHow: TypeAlias = Literal["left", "right", "inner", "outer"]
464
+ JoinValidate: TypeAlias = Literal[
465
+ "one_to_one",
466
+ "1:1",
467
+ "one_to_many",
468
+ "1:m",
469
+ "many_to_one",
470
+ "m:1",
471
+ "many_to_many",
472
+ "m:m",
473
+ ]
474
+
475
+ # reindex
476
+ ReindexMethod: TypeAlias = FillnaOptions | Literal["nearest"]
477
+
478
+ MatplotlibColor: TypeAlias = str | Sequence[float]
479
+ TimeGrouperOrigin: TypeAlias = Union[
480
+ "Timestamp", Literal["epoch", "start", "start_day", "end", "end_day"]
481
+ ]
482
+ TimeAmbiguous: TypeAlias = (
483
+ Literal["infer", "NaT", "raise"] | bool | npt.NDArray[np.bool_]
484
+ )
485
+ TimeNonexistent: TypeAlias = (
486
+ Literal["shift_forward", "shift_backward", "NaT", "raise"] | timedelta
487
+ )
488
+
489
+ DropKeep: TypeAlias = Literal["first", "last", False]
490
+ CorrelationMethod: TypeAlias = (
491
+ Literal["pearson", "kendall", "spearman"]
492
+ | Callable[[np.ndarray, np.ndarray], float]
493
+ )
494
+
495
+ AlignJoin: TypeAlias = Literal["outer", "inner", "left", "right"]
496
+ DtypeBackend: TypeAlias = Literal["pyarrow", "numpy_nullable"]
497
+
498
+ TimeUnit: TypeAlias = Literal["s", "ms", "us", "ns"]
499
+ OpenFileErrors: TypeAlias = Literal[
500
+ "strict",
501
+ "ignore",
502
+ "replace",
503
+ "surrogateescape",
504
+ "xmlcharrefreplace",
505
+ "backslashreplace",
506
+ "namereplace",
507
+ ]
508
+
509
+ # update
510
+ UpdateJoin: TypeAlias = Literal["left"]
511
+
512
+ # applymap
513
+ NaAction: TypeAlias = Literal["ignore"]
514
+
515
+ # from_dict
516
+ FromDictOrient: TypeAlias = Literal["columns", "index", "tight"]
517
+
518
+ # to_stata
519
+ ToStataByteorder: TypeAlias = Literal[">", "<", "little", "big"]
520
+
521
+ # ExcelWriter
522
+ ExcelWriterIfSheetExists: TypeAlias = Literal["error", "new", "replace", "overlay"]
523
+ ExcelWriterMergeCells: TypeAlias = bool | Literal["columns"]
524
+
525
+ # Offsets
526
+ OffsetCalendar: TypeAlias = Union[np.busdaycalendar, "AbstractHolidayCalendar"]
527
+
528
+ # read_csv: usecols
529
+ UsecolsArgType: TypeAlias = (
530
+ SequenceNotStr[Hashable] | range | AnyArrayLike | Callable[[HashableT], bool] | None
531
+ )
532
+
533
+ # maintain the sub-type of any hashable sequence
534
+ SequenceT = TypeVar("SequenceT", bound=Sequence[Hashable])
535
+
536
+ SliceType: TypeAlias = Hashable | None
537
+
538
+
539
+ # Arrow PyCapsule Interface
540
+ # from https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html#protocol-typehints
541
+
542
+
543
+ class ArrowArrayExportable(Protocol):
544
+ """
545
+ An object with an ``__arrow_c_array__`` method.
546
+
547
+ This method indicates the object is an Arrow-compatible object implementing
548
+ the `Arrow PyCapsule Protocol`_ (exposing the `Arrow C Data Interface`_ in
549
+ Python), enabling zero-copy Arrow data interchange across libraries.
550
+
551
+ .. _Arrow PyCapsule Protocol: https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html
552
+ .. _Arrow C Data Interface: https://arrow.apache.org/docs/format/CDataInterface.html
553
+
554
+ """
555
+
556
+ def __arrow_c_array__(
557
+ self, requested_schema: object | None = None
558
+ ) -> tuple[object, object]: ...
559
+
560
+
561
+ class ArrowStreamExportable(Protocol):
562
+ """
563
+ An object with an ``__arrow_c_stream__`` method.
564
+
565
+ This method indicates the object is an Arrow-compatible object implementing
566
+ the `Arrow PyCapsule Protocol`_ (exposing the `Arrow C Data Interface`_
567
+ for streams in Python), enabling zero-copy Arrow data interchange across
568
+ libraries.
569
+
570
+ .. _Arrow PyCapsule Protocol: https://arrow.apache.org/docs/format/CDataInterface/PyCapsuleInterface.html
571
+ .. _Arrow C Stream Interface: https://arrow.apache.org/docs/format/CStreamInterface.html
572
+
573
+ """
574
+
575
+ def __arrow_c_stream__(self, requested_schema: object | None = None) -> object: ...
576
+
577
+
578
+ __all__ = ["type_t"]
.venv/lib/python3.11/site-packages/pandas/_version.py ADDED
@@ -0,0 +1,692 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # This file helps to compute a version number in source trees obtained from
2
+ # git-archive tarball (such as those provided by github's download-from-tag
3
+ # feature). Distribution tarballs (built by setup.py sdist) and build
4
+ # directories (produced by setup.py build) will contain a much shorter file
5
+ # that just contains the computed version number.
6
+
7
+ # This file is released into the public domain.
8
+ # Generated by versioneer-0.28
9
+ # https://github.com/python-versioneer/python-versioneer
10
+
11
+ """Git implementation of _version.py."""
12
+
13
+ from collections.abc import Callable
14
+ import errno
15
+ import functools
16
+ import os
17
+ import re
18
+ import subprocess
19
+ import sys
20
+
21
+
22
+ def get_keywords():
23
+ """Get the keywords needed to look up the version information."""
24
+ # these strings will be replaced by git during git-archive.
25
+ # setup.py/versioneer.py will grep for the variable names, so they must
26
+ # each be defined on a line of their own. _version.py will just call
27
+ # get_keywords().
28
+ git_refnames = " (HEAD, tag: v3.0.5)"
29
+ git_full = "e68db09ecf6427d1b62e565bacf17f2e525a3032"
30
+ git_date = "2026-07-22 14:14:48 -0700"
31
+ keywords = {"refnames": git_refnames, "full": git_full, "date": git_date}
32
+ return keywords
33
+
34
+
35
+ class VersioneerConfig:
36
+ """Container for Versioneer configuration parameters."""
37
+
38
+
39
+ def get_config():
40
+ """Create, populate and return the VersioneerConfig() object."""
41
+ # these strings are filled in when 'setup.py versioneer' creates
42
+ # _version.py
43
+ cfg = VersioneerConfig()
44
+ cfg.VCS = "git"
45
+ cfg.style = "pep440"
46
+ cfg.tag_prefix = "v"
47
+ cfg.parentdir_prefix = "pandas-"
48
+ cfg.versionfile_source = "pandas/_version.py"
49
+ cfg.verbose = False
50
+ return cfg
51
+
52
+
53
+ class NotThisMethod(Exception):
54
+ """Exception raised if a method is not valid for the current scenario."""
55
+
56
+
57
+ LONG_VERSION_PY: dict[str, str] = {}
58
+ HANDLERS: dict[str, dict[str, Callable]] = {}
59
+
60
+
61
+ def register_vcs_handler(vcs, method): # decorator
62
+ """Create decorator to mark a method as the handler of a VCS."""
63
+
64
+ def decorate(f):
65
+ """Store f in HANDLERS[vcs][method]."""
66
+ if vcs not in HANDLERS:
67
+ HANDLERS[vcs] = {}
68
+ HANDLERS[vcs][method] = f
69
+ return f
70
+
71
+ return decorate
72
+
73
+
74
+ def run_command(commands, args, cwd=None, verbose=False, hide_stderr=False, env=None):
75
+ """Call the given command(s)."""
76
+ assert isinstance(commands, list)
77
+ process = None
78
+
79
+ popen_kwargs = {}
80
+ if sys.platform == "win32":
81
+ # This hides the console window if pythonw.exe is used
82
+ startupinfo = subprocess.STARTUPINFO()
83
+ startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
84
+ popen_kwargs["startupinfo"] = startupinfo
85
+
86
+ for command in commands:
87
+ dispcmd = str([command, *args])
88
+ try:
89
+ # remember shell=False, so use git.cmd on windows, not just git
90
+ process = subprocess.Popen(
91
+ [command, *args],
92
+ cwd=cwd,
93
+ env=env,
94
+ stdout=subprocess.PIPE,
95
+ stderr=(subprocess.PIPE if hide_stderr else None),
96
+ **popen_kwargs,
97
+ )
98
+ break
99
+ except OSError:
100
+ e = sys.exc_info()[1]
101
+ if e.errno == errno.ENOENT:
102
+ continue
103
+ if verbose:
104
+ print(f"unable to run {dispcmd}")
105
+ print(e)
106
+ return None, None
107
+ else:
108
+ if verbose:
109
+ print(f"unable to find command, tried {commands}")
110
+ return None, None
111
+ stdout = process.communicate()[0].strip().decode()
112
+ if process.returncode != 0:
113
+ if verbose:
114
+ print(f"unable to run {dispcmd} (error)")
115
+ print(f"stdout was {stdout}")
116
+ return None, process.returncode
117
+ return stdout, process.returncode
118
+
119
+
120
+ def versions_from_parentdir(parentdir_prefix, root, verbose):
121
+ """Try to determine the version from the parent directory name.
122
+
123
+ Source tarballs conventionally unpack into a directory that includes both
124
+ the project name and a version string. We will also support searching up
125
+ two directory levels for an appropriately named parent directory
126
+ """
127
+ rootdirs = []
128
+
129
+ for _ in range(3):
130
+ dirname = os.path.basename(root)
131
+ if dirname.startswith(parentdir_prefix):
132
+ return {
133
+ "version": dirname[len(parentdir_prefix) :],
134
+ "full-revisionid": None,
135
+ "dirty": False,
136
+ "error": None,
137
+ "date": None,
138
+ }
139
+ rootdirs.append(root)
140
+ root = os.path.dirname(root) # up a level
141
+
142
+ if verbose:
143
+ print(
144
+ f"Tried directories {rootdirs!s} \
145
+ but none started with prefix {parentdir_prefix}"
146
+ )
147
+ raise NotThisMethod("rootdir doesn't start with parentdir_prefix")
148
+
149
+
150
+ @register_vcs_handler("git", "get_keywords")
151
+ def git_get_keywords(versionfile_abs):
152
+ """Extract version information from the given file."""
153
+ # the code embedded in _version.py can just fetch the value of these
154
+ # keywords. When used from setup.py, we don't want to import _version.py,
155
+ # so we do it with a regexp instead. This function is not used from
156
+ # _version.py.
157
+ keywords = {}
158
+ try:
159
+ with open(versionfile_abs, encoding="utf-8") as fobj:
160
+ for line in fobj:
161
+ if line.strip().startswith("git_refnames ="):
162
+ mo = re.search(r'=\s*"(.*)"', line)
163
+ if mo:
164
+ keywords["refnames"] = mo.group(1)
165
+ if line.strip().startswith("git_full ="):
166
+ mo = re.search(r'=\s*"(.*)"', line)
167
+ if mo:
168
+ keywords["full"] = mo.group(1)
169
+ if line.strip().startswith("git_date ="):
170
+ mo = re.search(r'=\s*"(.*)"', line)
171
+ if mo:
172
+ keywords["date"] = mo.group(1)
173
+ except OSError:
174
+ pass
175
+ return keywords
176
+
177
+
178
+ @register_vcs_handler("git", "keywords")
179
+ def git_versions_from_keywords(keywords, tag_prefix, verbose):
180
+ """Get version information from git keywords."""
181
+ if "refnames" not in keywords:
182
+ raise NotThisMethod("Short version file found")
183
+ date = keywords.get("date")
184
+ if date is not None:
185
+ # Use only the last line. Previous lines may contain GPG signature
186
+ # information.
187
+ date = date.splitlines()[-1]
188
+
189
+ # git-2.2.0 added "%cI", which expands to an ISO-8601 -compliant
190
+ # datestamp. However we prefer "%ci" (which expands to an "ISO-8601
191
+ # -like" string, which we must then edit to make compliant), because
192
+ # it's been around since git-1.5.3, and it's too difficult to
193
+ # discover which version we're using, or to work around using an
194
+ # older one.
195
+ date = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
196
+ refnames = keywords["refnames"].strip()
197
+ if refnames.startswith("$Format"):
198
+ if verbose:
199
+ print("keywords are unexpanded, not using")
200
+ raise NotThisMethod("unexpanded keywords, not a git-archive tarball")
201
+ refs = {r.strip() for r in refnames.strip("()").split(",")}
202
+ # starting in git-1.8.3, tags are listed as "tag: foo-1.0" instead of
203
+ # just "foo-1.0". If we see a "tag: " prefix, prefer those.
204
+ TAG = "tag: "
205
+ tags = {r[len(TAG) :] for r in refs if r.startswith(TAG)}
206
+ if not tags:
207
+ # Either we're using git < 1.8.3, or there really are no tags. We use
208
+ # a heuristic: assume all version tags have a digit. The old git %d
209
+ # expansion behaves like git log --decorate=short and strips out the
210
+ # refs/heads/ and refs/tags/ prefixes that would let us distinguish
211
+ # between branches and tags. By ignoring refnames without digits, we
212
+ # filter out many common branch names like "release" and
213
+ # "stabilization", as well as "HEAD" and "master".
214
+ tags = {r for r in refs if re.search(r"\d", r)}
215
+ if verbose:
216
+ print(f"discarding '{','.join(refs - tags)}', no digits")
217
+ if verbose:
218
+ print(f"likely tags: {','.join(sorted(tags))}")
219
+ for ref in sorted(tags):
220
+ # sorting will prefer e.g. "2.0" over "2.0rc1"
221
+ if ref.startswith(tag_prefix):
222
+ r = ref[len(tag_prefix) :]
223
+ # Filter out refs that exactly match prefix or that don't start
224
+ # with a number once the prefix is stripped (mostly a concern
225
+ # when prefix is '')
226
+ if not re.match(r"\d", r):
227
+ continue
228
+ if verbose:
229
+ print(f"picking {r}")
230
+ return {
231
+ "version": r,
232
+ "full-revisionid": keywords["full"].strip(),
233
+ "dirty": False,
234
+ "error": None,
235
+ "date": date,
236
+ }
237
+ # no suitable tags, so version is "0+unknown", but full hex is still there
238
+ if verbose:
239
+ print("no suitable tags, using unknown + full revision id")
240
+ return {
241
+ "version": "0+unknown",
242
+ "full-revisionid": keywords["full"].strip(),
243
+ "dirty": False,
244
+ "error": "no suitable tags",
245
+ "date": None,
246
+ }
247
+
248
+
249
+ @register_vcs_handler("git", "pieces_from_vcs")
250
+ def git_pieces_from_vcs(tag_prefix, root, verbose, runner=run_command):
251
+ """Get version from 'git describe' in the root of the source tree.
252
+
253
+ This only gets called if the git-archive 'subst' keywords were *not*
254
+ expanded, and _version.py hasn't already been rewritten with a short
255
+ version string, meaning we're inside a checked out source tree.
256
+ """
257
+ GITS = ["git"]
258
+ if sys.platform == "win32":
259
+ GITS = ["git.cmd", "git.exe"]
260
+
261
+ # GIT_DIR can interfere with correct operation of Versioneer.
262
+ # It may be intended to be passed to the Versioneer-versioned project,
263
+ # but that should not change where we get our version from.
264
+ env = os.environ.copy()
265
+ env.pop("GIT_DIR", None)
266
+ runner = functools.partial(runner, env=env)
267
+
268
+ _, rc = runner(GITS, ["rev-parse", "--git-dir"], cwd=root, hide_stderr=not verbose)
269
+ if rc != 0:
270
+ if verbose:
271
+ print(f"Directory {root} not under git control")
272
+ raise NotThisMethod("'git rev-parse --git-dir' returned error")
273
+
274
+ # if there is a tag matching tag_prefix, this yields TAG-NUM-gHEX[-dirty]
275
+ # if there isn't one, this yields HEX[-dirty] (no NUM)
276
+ describe_out, rc = runner(
277
+ GITS,
278
+ [
279
+ "describe",
280
+ "--tags",
281
+ "--dirty",
282
+ "--always",
283
+ "--long",
284
+ "--match",
285
+ f"{tag_prefix}[[:digit:]]*",
286
+ ],
287
+ cwd=root,
288
+ )
289
+ # --long was added in git-1.5.5
290
+ if describe_out is None:
291
+ raise NotThisMethod("'git describe' failed")
292
+ describe_out = describe_out.strip()
293
+ full_out, rc = runner(GITS, ["rev-parse", "HEAD"], cwd=root)
294
+ if full_out is None:
295
+ raise NotThisMethod("'git rev-parse' failed")
296
+ full_out = full_out.strip()
297
+
298
+ pieces = {}
299
+ pieces["long"] = full_out
300
+ pieces["short"] = full_out[:7] # maybe improved later
301
+ pieces["error"] = None
302
+
303
+ branch_name, rc = runner(GITS, ["rev-parse", "--abbrev-ref", "HEAD"], cwd=root)
304
+ # --abbrev-ref was added in git-1.6.3
305
+ if rc != 0 or branch_name is None:
306
+ raise NotThisMethod("'git rev-parse --abbrev-ref' returned error")
307
+ branch_name = branch_name.strip()
308
+
309
+ if branch_name == "HEAD":
310
+ # If we aren't exactly on a branch, pick a branch which represents
311
+ # the current commit. If all else fails, we are on a branchless
312
+ # commit.
313
+ branches, rc = runner(GITS, ["branch", "--contains"], cwd=root)
314
+ # --contains was added in git-1.5.4
315
+ if rc != 0 or branches is None:
316
+ raise NotThisMethod("'git branch --contains' returned error")
317
+ branches = branches.split("\n")
318
+
319
+ # Remove the first line if we're running detached
320
+ if "(" in branches[0]:
321
+ branches.pop(0)
322
+
323
+ # Strip off the leading "* " from the list of branches.
324
+ branches = [branch[2:] for branch in branches]
325
+ if "master" in branches:
326
+ branch_name = "master"
327
+ elif not branches:
328
+ branch_name = None
329
+ else:
330
+ # Pick the first branch that is returned. Good or bad.
331
+ branch_name = branches[0]
332
+
333
+ pieces["branch"] = branch_name
334
+
335
+ # parse describe_out. It will be like TAG-NUM-gHEX[-dirty] or HEX[-dirty]
336
+ # TAG might have hyphens.
337
+ git_describe = describe_out
338
+
339
+ # look for -dirty suffix
340
+ dirty = git_describe.endswith("-dirty")
341
+ pieces["dirty"] = dirty
342
+ if dirty:
343
+ git_describe = git_describe[: git_describe.rindex("-dirty")]
344
+
345
+ # now we have TAG-NUM-gHEX or HEX
346
+
347
+ if "-" in git_describe:
348
+ # TAG-NUM-gHEX
349
+ mo = re.search(r"^(.+)-(\d+)-g([0-9a-f]+)$", git_describe)
350
+ if not mo:
351
+ # unparsable. Maybe git-describe is misbehaving?
352
+ pieces["error"] = f"unable to parse git-describe output: '{describe_out}'"
353
+ return pieces
354
+
355
+ # tag
356
+ full_tag = mo.group(1)
357
+ if not full_tag.startswith(tag_prefix):
358
+ if verbose:
359
+ fmt = "tag '%s' doesn't start with prefix '%s'"
360
+ print(fmt % (full_tag, tag_prefix))
361
+ pieces["error"] = (
362
+ f"tag '{full_tag}' doesn't start with prefix '{tag_prefix}'"
363
+ )
364
+ return pieces
365
+ pieces["closest-tag"] = full_tag[len(tag_prefix) :]
366
+
367
+ # distance: number of commits since tag
368
+ pieces["distance"] = int(mo.group(2))
369
+
370
+ # commit: short hex revision ID
371
+ pieces["short"] = mo.group(3)
372
+
373
+ else:
374
+ # HEX: no tags
375
+ pieces["closest-tag"] = None
376
+ out, rc = runner(GITS, ["rev-list", "HEAD", "--left-right"], cwd=root)
377
+ pieces["distance"] = len(out.split()) # total number of commits
378
+
379
+ # commit date: see ISO-8601 comment in git_versions_from_keywords()
380
+ date = runner(GITS, ["show", "-s", "--format=%ci", "HEAD"], cwd=root)[0].strip()
381
+ # Use only the last line. Previous lines may contain GPG signature
382
+ # information.
383
+ date = date.splitlines()[-1]
384
+ pieces["date"] = date.strip().replace(" ", "T", 1).replace(" ", "", 1)
385
+
386
+ return pieces
387
+
388
+
389
+ def plus_or_dot(pieces) -> str:
390
+ """Return a + if we don't already have one, else return a ."""
391
+ if "+" in pieces.get("closest-tag", ""):
392
+ return "."
393
+ return "+"
394
+
395
+
396
+ def render_pep440(pieces):
397
+ """Build up version string, with post-release "local version identifier".
398
+
399
+ Our goal: TAG[+DISTANCE.gHEX[.dirty]] . Note that if you
400
+ get a tagged build and then dirty it, you'll get TAG+0.gHEX.dirty
401
+
402
+ Exceptions:
403
+ 1: no tags. git_describe was just HEX. 0+untagged.DISTANCE.gHEX[.dirty]
404
+ """
405
+ if pieces["closest-tag"]:
406
+ rendered = pieces["closest-tag"]
407
+ if pieces["distance"] or pieces["dirty"]:
408
+ rendered += plus_or_dot(pieces)
409
+ rendered += f"{pieces['distance']}.g{pieces['short']}"
410
+ if pieces["dirty"]:
411
+ rendered += ".dirty"
412
+ else:
413
+ # exception #1
414
+ rendered = f"0+untagged.{pieces['distance']}.g{pieces['short']}"
415
+ if pieces["dirty"]:
416
+ rendered += ".dirty"
417
+ return rendered
418
+
419
+
420
+ def render_pep440_branch(pieces):
421
+ """TAG[[.dev0]+DISTANCE.gHEX[.dirty]] .
422
+
423
+ The ".dev0" means not master branch. Note that .dev0 sorts backwards
424
+ (a feature branch will appear "older" than the master branch).
425
+
426
+ Exceptions:
427
+ 1: no tags. 0[.dev0]+untagged.DISTANCE.gHEX[.dirty]
428
+ """
429
+ if pieces["closest-tag"]:
430
+ rendered = pieces["closest-tag"]
431
+ if pieces["distance"] or pieces["dirty"]:
432
+ if pieces["branch"] != "master":
433
+ rendered += ".dev0"
434
+ rendered += plus_or_dot(pieces)
435
+ rendered += f"{pieces['distance']}.g{pieces['short']}"
436
+ if pieces["dirty"]:
437
+ rendered += ".dirty"
438
+ else:
439
+ # exception #1
440
+ rendered = "0"
441
+ if pieces["branch"] != "master":
442
+ rendered += ".dev0"
443
+ rendered += f"+untagged.{pieces['distance']}.g{pieces['short']}"
444
+ if pieces["dirty"]:
445
+ rendered += ".dirty"
446
+ return rendered
447
+
448
+
449
+ def pep440_split_post(ver):
450
+ """Split pep440 version string at the post-release segment.
451
+
452
+ Returns the release segments before the post-release and the
453
+ post-release version number (or -1 if no post-release segment is present).
454
+ """
455
+ vc = str.split(ver, ".post")
456
+ return vc[0], int(vc[1] or 0) if len(vc) == 2 else None
457
+
458
+
459
+ def render_pep440_pre(pieces):
460
+ """TAG[.postN.devDISTANCE] -- No -dirty.
461
+
462
+ Exceptions:
463
+ 1: no tags. 0.post0.devDISTANCE
464
+ """
465
+ if pieces["closest-tag"]:
466
+ if pieces["distance"]:
467
+ # update the post release segment
468
+ tag_version, post_version = pep440_split_post(pieces["closest-tag"])
469
+ rendered = tag_version
470
+ if post_version is not None:
471
+ rendered += f".post{post_version + 1}.dev{pieces['distance']}"
472
+ else:
473
+ rendered += f".post0.dev{pieces['distance']}"
474
+ else:
475
+ # no commits, use the tag as the version
476
+ rendered = pieces["closest-tag"]
477
+ else:
478
+ # exception #1
479
+ rendered = f"0.post0.dev{pieces['distance']}"
480
+ return rendered
481
+
482
+
483
+ def render_pep440_post(pieces):
484
+ """TAG[.postDISTANCE[.dev0]+gHEX] .
485
+
486
+ The ".dev0" means dirty. Note that .dev0 sorts backwards
487
+ (a dirty tree will appear "older" than the corresponding clean one),
488
+ but you shouldn't be releasing software with -dirty anyways.
489
+
490
+ Exceptions:
491
+ 1: no tags. 0.postDISTANCE[.dev0]
492
+ """
493
+ if pieces["closest-tag"]:
494
+ rendered = pieces["closest-tag"]
495
+ if pieces["distance"] or pieces["dirty"]:
496
+ rendered += f".post{pieces['distance']}"
497
+ if pieces["dirty"]:
498
+ rendered += ".dev0"
499
+ rendered += plus_or_dot(pieces)
500
+ rendered += f"g{pieces['short']}"
501
+ else:
502
+ # exception #1
503
+ rendered = f"0.post{pieces['distance']}"
504
+ if pieces["dirty"]:
505
+ rendered += ".dev0"
506
+ rendered += f"+g{pieces['short']}"
507
+ return rendered
508
+
509
+
510
+ def render_pep440_post_branch(pieces):
511
+ """TAG[.postDISTANCE[.dev0]+gHEX[.dirty]] .
512
+
513
+ The ".dev0" means not master branch.
514
+
515
+ Exceptions:
516
+ 1: no tags. 0.postDISTANCE[.dev0]+gHEX[.dirty]
517
+ """
518
+ if pieces["closest-tag"]:
519
+ rendered = pieces["closest-tag"]
520
+ if pieces["distance"] or pieces["dirty"]:
521
+ rendered += f".post{pieces['distance']}"
522
+ if pieces["branch"] != "master":
523
+ rendered += ".dev0"
524
+ rendered += plus_or_dot(pieces)
525
+ rendered += f"g{pieces['short']}"
526
+ if pieces["dirty"]:
527
+ rendered += ".dirty"
528
+ else:
529
+ # exception #1
530
+ rendered = f"0.post{pieces['distance']}"
531
+ if pieces["branch"] != "master":
532
+ rendered += ".dev0"
533
+ rendered += f"+g{pieces['short']}"
534
+ if pieces["dirty"]:
535
+ rendered += ".dirty"
536
+ return rendered
537
+
538
+
539
+ def render_pep440_old(pieces):
540
+ """TAG[.postDISTANCE[.dev0]] .
541
+
542
+ The ".dev0" means dirty.
543
+
544
+ Exceptions:
545
+ 1: no tags. 0.postDISTANCE[.dev0]
546
+ """
547
+ if pieces["closest-tag"]:
548
+ rendered = pieces["closest-tag"]
549
+ if pieces["distance"] or pieces["dirty"]:
550
+ rendered += f"0.post{pieces['distance']}"
551
+ if pieces["dirty"]:
552
+ rendered += ".dev0"
553
+ else:
554
+ # exception #1
555
+ rendered = f"0.post{pieces['distance']}"
556
+ if pieces["dirty"]:
557
+ rendered += ".dev0"
558
+ return rendered
559
+
560
+
561
+ def render_git_describe(pieces):
562
+ """TAG[-DISTANCE-gHEX][-dirty].
563
+
564
+ Like 'git describe --tags --dirty --always'.
565
+
566
+ Exceptions:
567
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
568
+ """
569
+ if pieces["closest-tag"]:
570
+ rendered = pieces["closest-tag"]
571
+ if pieces["distance"]:
572
+ rendered += f"-{pieces['distance']}-g{pieces['short']}"
573
+ else:
574
+ # exception #1
575
+ rendered = pieces["short"]
576
+ if pieces["dirty"]:
577
+ rendered += "-dirty"
578
+ return rendered
579
+
580
+
581
+ def render_git_describe_long(pieces):
582
+ """TAG-DISTANCE-gHEX[-dirty].
583
+
584
+ Like 'git describe --tags --dirty --always --long'.
585
+ The distance/hash is unconditional.
586
+
587
+ Exceptions:
588
+ 1: no tags. HEX[-dirty] (note: no 'g' prefix)
589
+ """
590
+ if pieces["closest-tag"]:
591
+ rendered = pieces["closest-tag"]
592
+ rendered += f"-{pieces['distance']}-g{pieces['short']}"
593
+ else:
594
+ # exception #1
595
+ rendered = pieces["short"]
596
+ if pieces["dirty"]:
597
+ rendered += "-dirty"
598
+ return rendered
599
+
600
+
601
+ def render(pieces, style):
602
+ """Render the given version pieces into the requested style."""
603
+ if pieces["error"]:
604
+ return {
605
+ "version": "unknown",
606
+ "full-revisionid": pieces.get("long"),
607
+ "dirty": None,
608
+ "error": pieces["error"],
609
+ "date": None,
610
+ }
611
+
612
+ if not style or style == "default":
613
+ style = "pep440" # the default
614
+
615
+ if style == "pep440":
616
+ rendered = render_pep440(pieces)
617
+ elif style == "pep440-branch":
618
+ rendered = render_pep440_branch(pieces)
619
+ elif style == "pep440-pre":
620
+ rendered = render_pep440_pre(pieces)
621
+ elif style == "pep440-post":
622
+ rendered = render_pep440_post(pieces)
623
+ elif style == "pep440-post-branch":
624
+ rendered = render_pep440_post_branch(pieces)
625
+ elif style == "pep440-old":
626
+ rendered = render_pep440_old(pieces)
627
+ elif style == "git-describe":
628
+ rendered = render_git_describe(pieces)
629
+ elif style == "git-describe-long":
630
+ rendered = render_git_describe_long(pieces)
631
+ else:
632
+ raise ValueError(f"unknown style '{style}'")
633
+
634
+ return {
635
+ "version": rendered,
636
+ "full-revisionid": pieces["long"],
637
+ "dirty": pieces["dirty"],
638
+ "error": None,
639
+ "date": pieces.get("date"),
640
+ }
641
+
642
+
643
+ def get_versions() -> dict:
644
+ """Get version information or return default if unable to do so."""
645
+ # I am in _version.py, which lives at ROOT/VERSIONFILE_SOURCE. If we have
646
+ # __file__, we can work backwards from there to the root. Some
647
+ # py2exe/bbfreeze/non-CPython implementations don't do __file__, in which
648
+ # case we can only use expanded keywords.
649
+
650
+ cfg = get_config()
651
+ verbose = cfg.verbose
652
+
653
+ try:
654
+ return git_versions_from_keywords(get_keywords(), cfg.tag_prefix, verbose)
655
+ except NotThisMethod:
656
+ pass
657
+
658
+ try:
659
+ root = os.path.realpath(__file__)
660
+ # versionfile_source is the relative path from the top of the source
661
+ # tree (where the .git directory might live) to this file. Invert
662
+ # this to find the root from __file__.
663
+ for _ in cfg.versionfile_source.split("/"):
664
+ root = os.path.dirname(root)
665
+ except NameError:
666
+ return {
667
+ "version": "0+unknown",
668
+ "full-revisionid": None,
669
+ "dirty": None,
670
+ "error": "unable to find root of source tree",
671
+ "date": None,
672
+ }
673
+
674
+ try:
675
+ pieces = git_pieces_from_vcs(cfg.tag_prefix, root, verbose)
676
+ return render(pieces, cfg.style)
677
+ except NotThisMethod:
678
+ pass
679
+
680
+ try:
681
+ if cfg.parentdir_prefix:
682
+ return versions_from_parentdir(cfg.parentdir_prefix, root, verbose)
683
+ except NotThisMethod:
684
+ pass
685
+
686
+ return {
687
+ "version": "0+unknown",
688
+ "full-revisionid": None,
689
+ "dirty": None,
690
+ "error": "unable to compute version",
691
+ "date": None,
692
+ }
.venv/lib/python3.11/site-packages/pandas/_version_meson.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ __version__="3.0.5"
2
+ __git_version__="e68db09ecf6427d1b62e565bacf17f2e525a3032"
.venv/lib/python3.11/site-packages/pandas/api/__init__.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """public toolkit API"""
2
+
3
+ from pandas.api import (
4
+ executors,
5
+ extensions,
6
+ indexers,
7
+ interchange,
8
+ types,
9
+ typing,
10
+ )
11
+
12
+ __all__ = [
13
+ "executors",
14
+ "extensions",
15
+ "indexers",
16
+ "interchange",
17
+ "types",
18
+ "typing",
19
+ ]
.venv/lib/python3.11/site-packages/pandas/api/executors/__init__.py ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ """
2
+ Public API for function executor engines to be used with ``map`` and ``apply``.
3
+ """
4
+
5
+ from pandas.core.apply import BaseExecutionEngine
6
+
7
+ __all__ = ["BaseExecutionEngine"]
.venv/lib/python3.11/site-packages/pandas/api/extensions/__init__.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Public API for extending pandas objects.
3
+ """
4
+
5
+ from pandas._libs.lib import no_default
6
+
7
+ from pandas.core.dtypes.base import (
8
+ ExtensionDtype,
9
+ register_extension_dtype,
10
+ )
11
+
12
+ from pandas.core.accessor import (
13
+ register_dataframe_accessor,
14
+ register_index_accessor,
15
+ register_series_accessor,
16
+ )
17
+ from pandas.core.algorithms import take
18
+ from pandas.core.arrays import (
19
+ ExtensionArray,
20
+ ExtensionScalarOpsMixin,
21
+ )
22
+
23
+ __all__ = [
24
+ "ExtensionArray",
25
+ "ExtensionDtype",
26
+ "ExtensionScalarOpsMixin",
27
+ "no_default",
28
+ "register_dataframe_accessor",
29
+ "register_extension_dtype",
30
+ "register_index_accessor",
31
+ "register_series_accessor",
32
+ "take",
33
+ ]
.venv/lib/python3.11/site-packages/pandas/api/indexers/__init__.py ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Public API for Rolling Window Indexers.
3
+ """
4
+
5
+ from pandas.core.indexers import check_array_indexer
6
+ from pandas.core.indexers.objects import (
7
+ BaseIndexer,
8
+ FixedForwardWindowIndexer,
9
+ VariableOffsetWindowIndexer,
10
+ )
11
+
12
+ __all__ = [
13
+ "BaseIndexer",
14
+ "FixedForwardWindowIndexer",
15
+ "VariableOffsetWindowIndexer",
16
+ "check_array_indexer",
17
+ ]
.venv/lib/python3.11/site-packages/pandas/api/interchange/__init__.py ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Public API for DataFrame interchange protocol.
3
+ """
4
+
5
+ from pandas.core.interchange.dataframe_protocol import DataFrame
6
+ from pandas.core.interchange.from_dataframe import from_dataframe
7
+
8
+ __all__ = ["DataFrame", "from_dataframe"]
.venv/lib/python3.11/site-packages/pandas/api/internals.py ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import numpy as np
2
+
3
+ from pandas._typing import ArrayLike
4
+
5
+ from pandas import (
6
+ DataFrame,
7
+ Index,
8
+ )
9
+ from pandas.core.internals.api import _make_block
10
+ from pandas.core.internals.managers import BlockManager as _BlockManager
11
+
12
+
13
+ def create_dataframe_from_blocks(
14
+ blocks: list[tuple[ArrayLike, np.ndarray]], index: Index, columns: Index
15
+ ) -> DataFrame:
16
+ """
17
+ Low-level function to create a DataFrame from arrays as they are
18
+ representing the block structure of the resulting DataFrame.
19
+
20
+ Attention: this is an advanced, low-level function that should only be
21
+ used if you know that the below-mentioned assumptions are guaranteed.
22
+ If passing data that do not follow those assumptions, subsequent
23
+ subsequent operations on the resulting DataFrame might lead to strange
24
+ errors.
25
+ For almost all use cases, you should use the standard pd.DataFrame(..)
26
+ constructor instead. If you are planning to use this function, let us
27
+ know by opening an issue at https://github.com/pandas-dev/pandas/issues.
28
+
29
+ Assumptions:
30
+
31
+ - The block arrays are either a 2D numpy array or a pandas ExtensionArray
32
+ - In case of a numpy array, it is assumed to already be in the expected
33
+ shape for Blocks (2D, (cols, rows), i.e. transposed compared to the
34
+ DataFrame columns).
35
+ - All arrays are taken as is (no type inference) and expected to have the
36
+ correct size.
37
+ - The placement arrays have the correct length (equalling the number of
38
+ columns that its equivalent block array represents), and all placement
39
+ arrays together form a complete set of 0 to n_columns - 1.
40
+
41
+ Parameters
42
+ ----------
43
+ blocks : list of tuples of (block_array, block_placement)
44
+ This should be a list of tuples existing of (block_array, block_placement),
45
+ where:
46
+
47
+ - block_array is a 2D numpy array or a 1D ExtensionArray, following the
48
+ requirements listed above.
49
+ - block_placement is a 1D integer numpy array
50
+ index : Index
51
+ The Index object for the `index` of the resulting DataFrame.
52
+ columns : Index
53
+ The Index object for the `columns` of the resulting DataFrame.
54
+
55
+ Returns
56
+ -------
57
+ DataFrame
58
+ """
59
+ block_objs = [_make_block(*block) for block in blocks]
60
+ axes = [columns, index]
61
+ mgr = _BlockManager(block_objs, axes)
62
+ return DataFrame._from_mgr(mgr, mgr.axes)
.venv/lib/python3.11/site-packages/pandas/api/types/__init__.py ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Public toolkit API.
3
+ """
4
+
5
+ from pandas._libs.lib import infer_dtype
6
+
7
+ from pandas.core.dtypes.api import * # noqa: F403
8
+ from pandas.core.dtypes.concat import union_categoricals
9
+ from pandas.core.dtypes.dtypes import (
10
+ CategoricalDtype,
11
+ DatetimeTZDtype,
12
+ IntervalDtype,
13
+ PeriodDtype,
14
+ )
15
+
16
+ __all__ = [
17
+ "CategoricalDtype",
18
+ "DatetimeTZDtype",
19
+ "IntervalDtype",
20
+ "PeriodDtype",
21
+ "infer_dtype",
22
+ "union_categoricals",
23
+ ]
.venv/lib/python3.11/site-packages/pandas/api/typing/__init__.py ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Public API classes that store intermediate results useful for type-hinting.
3
+ """
4
+
5
+ from pandas._libs import NaTType
6
+ from pandas._libs.lib import NoDefault
7
+ from pandas._libs.missing import NAType
8
+
9
+ from pandas.core.col import Expression
10
+ from pandas.core.groupby import (
11
+ DataFrameGroupBy,
12
+ SeriesGroupBy,
13
+ )
14
+ from pandas.core.indexes.frozen import FrozenList
15
+ from pandas.core.resample import (
16
+ DatetimeIndexResamplerGroupby,
17
+ PeriodIndexResamplerGroupby,
18
+ Resampler,
19
+ TimedeltaIndexResamplerGroupby,
20
+ TimeGrouper,
21
+ )
22
+ from pandas.core.window import (
23
+ Expanding,
24
+ ExpandingGroupby,
25
+ ExponentialMovingWindow,
26
+ ExponentialMovingWindowGroupby,
27
+ Rolling,
28
+ RollingGroupby,
29
+ Window,
30
+ )
31
+
32
+ # TODO: Can't import Styler without importing jinja2
33
+ # from pandas.io.formats.style import Styler
34
+ from pandas.io.json._json import JsonReader
35
+ from pandas.io.sas.sasreader import SASReader
36
+ from pandas.io.stata import StataReader
37
+
38
+ __all__ = [
39
+ "DataFrameGroupBy",
40
+ "DatetimeIndexResamplerGroupby",
41
+ "Expanding",
42
+ "ExpandingGroupby",
43
+ "ExponentialMovingWindow",
44
+ "ExponentialMovingWindowGroupby",
45
+ "Expression",
46
+ "FrozenList",
47
+ "JsonReader",
48
+ "NAType",
49
+ "NaTType",
50
+ "NoDefault",
51
+ "PeriodIndexResamplerGroupby",
52
+ "Resampler",
53
+ "Rolling",
54
+ "RollingGroupby",
55
+ "SASReader",
56
+ "SeriesGroupBy",
57
+ "StataReader",
58
+ "TimeGrouper",
59
+ "TimedeltaIndexResamplerGroupby",
60
+ "Window",
61
+ ]
.venv/lib/python3.11/site-packages/pandas/api/typing/aliases.py ADDED
@@ -0,0 +1,145 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from pandas._typing import (
2
+ AggFuncType,
3
+ AlignJoin,
4
+ AnyAll,
5
+ AnyArrayLike,
6
+ ArrayLike,
7
+ AstypeArg,
8
+ Axes,
9
+ Axis,
10
+ ColspaceArgType,
11
+ CompressionOptions,
12
+ CorrelationMethod,
13
+ CSVEngine,
14
+ DropKeep,
15
+ Dtype,
16
+ DtypeArg,
17
+ DtypeBackend,
18
+ DtypeObj,
19
+ ExcelWriterIfSheetExists,
20
+ ExcelWriterMergeCells,
21
+ FilePath,
22
+ FillnaOptions,
23
+ FloatFormatType,
24
+ FormattersType,
25
+ FromDictOrient,
26
+ HTMLFlavors,
27
+ IgnoreRaise,
28
+ IndexLabel,
29
+ InterpolateOptions,
30
+ IntervalClosedType,
31
+ IntervalLeftRight,
32
+ JoinHow,
33
+ JoinValidate,
34
+ JSONEngine,
35
+ JSONSerializable,
36
+ ListLike,
37
+ MergeHow,
38
+ MergeValidate,
39
+ NaPosition,
40
+ NsmallestNlargestKeep,
41
+ OpenFileErrors,
42
+ Ordered,
43
+ ParquetCompressionOptions,
44
+ QuantileInterpolation,
45
+ ReadBuffer,
46
+ ReadCsvBuffer,
47
+ ReadPickleBuffer,
48
+ ReindexMethod,
49
+ Scalar,
50
+ ScalarIndexer,
51
+ SequenceIndexer,
52
+ SequenceNotStr,
53
+ SliceType,
54
+ SortKind,
55
+ StorageOptions,
56
+ Suffixes,
57
+ TakeIndexer,
58
+ TimeAmbiguous,
59
+ TimedeltaConvertibleTypes,
60
+ TimeGrouperOrigin,
61
+ TimeNonexistent,
62
+ TimestampConvertibleTypes,
63
+ TimeUnit,
64
+ ToStataByteorder,
65
+ ToTimestampHow,
66
+ UpdateJoin,
67
+ UsecolsArgType,
68
+ WindowingRankType,
69
+ WriteBuffer,
70
+ WriteExcelBuffer,
71
+ XMLParsers,
72
+ )
73
+
74
+ __all__ = [
75
+ "AggFuncType",
76
+ "AlignJoin",
77
+ "AnyAll",
78
+ "AnyArrayLike",
79
+ "ArrayLike",
80
+ "AstypeArg",
81
+ "Axes",
82
+ "Axis",
83
+ "CSVEngine",
84
+ "ColspaceArgType",
85
+ "CompressionOptions",
86
+ "CorrelationMethod",
87
+ "DropKeep",
88
+ "Dtype",
89
+ "DtypeArg",
90
+ "DtypeBackend",
91
+ "DtypeObj",
92
+ "ExcelWriterIfSheetExists",
93
+ "ExcelWriterMergeCells",
94
+ "FilePath",
95
+ "FillnaOptions",
96
+ "FloatFormatType",
97
+ "FormattersType",
98
+ "FromDictOrient",
99
+ "HTMLFlavors",
100
+ "IgnoreRaise",
101
+ "IndexLabel",
102
+ "InterpolateOptions",
103
+ "IntervalClosedType",
104
+ "IntervalLeftRight",
105
+ "JSONEngine",
106
+ "JSONSerializable",
107
+ "JoinHow",
108
+ "JoinValidate",
109
+ "ListLike",
110
+ "MergeHow",
111
+ "MergeValidate",
112
+ "NaPosition",
113
+ "NsmallestNlargestKeep",
114
+ "OpenFileErrors",
115
+ "Ordered",
116
+ "ParquetCompressionOptions",
117
+ "QuantileInterpolation",
118
+ "ReadBuffer",
119
+ "ReadCsvBuffer",
120
+ "ReadPickleBuffer",
121
+ "ReindexMethod",
122
+ "Scalar",
123
+ "ScalarIndexer",
124
+ "SequenceIndexer",
125
+ "SequenceNotStr",
126
+ "SliceType",
127
+ "SortKind",
128
+ "StorageOptions",
129
+ "Suffixes",
130
+ "TakeIndexer",
131
+ "TimeAmbiguous",
132
+ "TimeGrouperOrigin",
133
+ "TimeNonexistent",
134
+ "TimeUnit",
135
+ "TimedeltaConvertibleTypes",
136
+ "TimestampConvertibleTypes",
137
+ "ToStataByteorder",
138
+ "ToTimestampHow",
139
+ "UpdateJoin",
140
+ "UsecolsArgType",
141
+ "WindowingRankType",
142
+ "WriteBuffer",
143
+ "WriteExcelBuffer",
144
+ "XMLParsers",
145
+ ]