forked from pandas-dev/pandas-stubs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathseries.pyi
2461 lines (2446 loc) · 73.6 KB
/
series.pyi
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from collections import dict_keys # type: ignore[attr-defined]
from collections.abc import (
Callable,
Hashable,
Iterable,
Iterator,
Mapping,
MutableMapping,
Sequence,
)
from datetime import (
date,
datetime,
time,
timedelta,
)
from pathlib import Path
from typing import (
Any,
ClassVar,
Generic,
Literal,
NoReturn,
overload,
)
from matplotlib.axes import (
Axes as PlotAxes,
SubplotBase,
)
import numpy as np
from pandas import (
Period,
PeriodDtype,
Timedelta,
Timestamp,
)
from pandas.core.api import (
Int8Dtype as Int8Dtype,
Int16Dtype as Int16Dtype,
Int32Dtype as Int32Dtype,
Int64Dtype as Int64Dtype,
)
from pandas.core.arrays import TimedeltaArray
from pandas.core.arrays.base import ExtensionArray
from pandas.core.arrays.categorical import CategoricalAccessor
from pandas.core.arrays.datetimes import DatetimeArray
from pandas.core.arrays.interval import IntervalArray
from pandas.core.base import IndexOpsMixin
from pandas.core.frame import DataFrame
from pandas.core.generic import NDFrame
from pandas.core.groupby.generic import SeriesGroupBy
from pandas.core.groupby.groupby import BaseGroupBy
from pandas.core.indexers import BaseIndexer
from pandas.core.indexes.accessors import (
CombinedDatetimelikeProperties,
PeriodProperties,
TimedeltaProperties,
TimestampProperties,
)
from pandas.core.indexes.base import Index
from pandas.core.indexes.category import CategoricalIndex
from pandas.core.indexes.datetimes import DatetimeIndex
from pandas.core.indexes.interval import IntervalIndex
from pandas.core.indexes.multi import MultiIndex
from pandas.core.indexes.period import PeriodIndex
from pandas.core.indexes.timedeltas import TimedeltaIndex
from pandas.core.indexing import (
_AtIndexer,
_iAtIndexer,
_iLocIndexer,
_IndexSliceTuple,
_LocIndexer,
)
from pandas.core.strings import StringMethods
from pandas.core.window import (
Expanding,
ExponentialMovingWindow,
)
from pandas.core.window.rolling import (
Rolling,
Window,
)
from typing_extensions import (
Never,
Self,
TypeAlias,
)
import xarray as xr
from pandas._libs.interval import (
Interval,
_OrderableT,
)
from pandas._libs.lib import NoDefault
from pandas._libs.missing import NAType
from pandas._libs.tslibs import BaseOffset
from pandas._libs.tslibs.nattype import NaTType
from pandas._typing import (
S1,
S2,
AggFuncTypeBase,
AggFuncTypeDictFrame,
AggFuncTypeSeriesToFrame,
AnyArrayLike,
ArrayLike,
Axes,
Axis,
AxisColumn,
AxisIndex,
BooleanDtypeArg,
BytesDtypeArg,
CalculationMethod,
CategoryDtypeArg,
ComplexDtypeArg,
CompressionOptions,
Dtype,
DtypeObj,
FilePath,
FillnaOptions,
FloatDtypeArg,
GroupByObjectNonScalar,
HashableT1,
IgnoreRaise,
IndexingInt,
IndexLabel,
IntDtypeArg,
InterpolateOptions,
IntervalClosedType,
IntervalT,
JoinHow,
JsonSeriesOrient,
Level,
ListLike,
ListLikeU,
MaskType,
NaPosition,
ObjectDtypeArg,
QuantileInterpolation,
RandomState,
Renamer,
ReplaceMethod,
Scalar,
ScalarT,
SequenceNotStr,
SeriesByT,
SortKind,
StrDtypeArg,
StrLike,
T,
TimedeltaDtypeArg,
TimestampConvention,
TimestampDtypeArg,
TimeUnit,
UIntDtypeArg,
VoidDtypeArg,
WriteBuffer,
np_ndarray_anyint,
npt,
num,
)
from pandas.core.dtypes.base import ExtensionDtype
from pandas.core.dtypes.dtypes import CategoricalDtype
from pandas.plotting import PlotAccessor
_bool = bool
_str = str
class _iLocIndexerSeries(_iLocIndexer, Generic[S1]):
# get item
@overload
def __getitem__(self, idx: IndexingInt) -> S1: ...
@overload
def __getitem__(self, idx: Index | slice | np_ndarray_anyint) -> Series[S1]: ...
# set item
@overload
def __setitem__(self, idx: int, value: S1 | None) -> None: ...
@overload
def __setitem__(
self,
idx: Index | slice | np_ndarray_anyint | list[int],
value: S1 | Series[S1] | None,
) -> None: ...
class _LocIndexerSeries(_LocIndexer, Generic[S1]):
# ignore needed because of mypy. Overlapping, but we want to distinguish
# having a tuple of just scalars, versus tuples that include slices or Index
@overload
def __getitem__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
self,
idx: Scalar | tuple[Scalar, ...],
# tuple case is for getting a specific element when using a MultiIndex
) -> S1: ...
@overload
def __getitem__(
self,
idx: (
MaskType
| Index
| SequenceNotStr[float | str | Timestamp]
| slice
| _IndexSliceTuple
| Sequence[_IndexSliceTuple]
| Callable
),
# _IndexSliceTuple is when having a tuple that includes a slice. Could just
# be s.loc[1, :], or s.loc[pd.IndexSlice[1, :]]
) -> Series[S1]: ...
@overload
def __setitem__(
self,
idx: Index | MaskType | slice,
value: S1 | ArrayLike | Series[S1] | None,
) -> None: ...
@overload
def __setitem__(
self,
idx: str,
value: S1 | None,
) -> None: ...
@overload
def __setitem__(
self,
idx: MaskType | StrLike | _IndexSliceTuple | list[ScalarT],
value: S1 | ArrayLike | Series[S1] | None,
) -> None: ...
_ListLike: TypeAlias = (
ArrayLike | dict[_str, np.ndarray] | Sequence[S1] | IndexOpsMixin[S1]
)
class Series(IndexOpsMixin[S1], NDFrame):
__hash__: ClassVar[None]
@overload
def __new__(
cls,
data: npt.NDArray[np.float64],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[float]: ...
@overload
def __new__( # type: ignore[overload-overlap]
cls,
data: Sequence[Never],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[Any]: ...
@overload
def __new__(
cls,
data: Sequence[list[str]],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[list[str]]: ...
@overload
def __new__(
cls,
data: Sequence[str],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[str]: ...
@overload
def __new__(
cls,
data: (
DatetimeIndex
| Sequence[np.datetime64 | datetime | date]
| dict[HashableT1, np.datetime64 | datetime | date]
| np.datetime64
| datetime
| date
),
index: Axes | None = ...,
*,
dtype: TimestampDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
) -> TimestampSeries: ...
@overload
def __new__(
cls,
data: _ListLike,
index: Axes | None = ...,
*,
dtype: TimestampDtypeArg,
name: Hashable = ...,
copy: bool = ...,
) -> TimestampSeries: ...
@overload
def __new__(
cls,
data: PeriodIndex | Sequence[Period],
index: Axes | None = ...,
*,
dtype: PeriodDtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> PeriodSeries: ...
@overload
def __new__(
cls,
data: (
TimedeltaIndex
| Sequence[np.timedelta64 | timedelta]
| dict[HashableT1, np.timedelta64 | timedelta]
| np.timedelta64
| timedelta
),
index: Axes | None = ...,
*,
dtype: TimedeltaDtypeArg = ...,
name: Hashable = ...,
copy: bool = ...,
) -> TimedeltaSeries: ...
@overload
def __new__(
cls,
data: (
IntervalIndex[Interval[_OrderableT]]
| Interval[_OrderableT]
| Sequence[Interval[_OrderableT]]
| dict[HashableT1, Interval[_OrderableT]]
),
index: Axes | None = ...,
*,
dtype: Literal["Interval"] = ...,
name: Hashable = ...,
copy: bool = ...,
) -> IntervalSeries[_OrderableT]: ...
@overload
def __new__( # type: ignore[overload-overlap]
cls,
data: Scalar | _ListLike | dict[HashableT1, Any] | None,
index: Axes | None = ...,
*,
dtype: type[S1],
name: Hashable = ...,
copy: bool = ...,
) -> Self: ...
@overload
def __new__( # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload]
cls,
data: Sequence[bool],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[bool]: ...
@overload
def __new__( # type: ignore[overload-overlap]
cls,
data: Sequence[int],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[int]: ...
@overload
def __new__(
cls,
data: Sequence[float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[float]: ...
@overload
def __new__( # type: ignore[overload-cannot-match] # pyright: ignore[reportOverlappingOverload]
cls,
data: Sequence[int | float],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series[float]: ...
@overload
def __new__(
cls,
data: S1 | _ListLike[S1] | dict[HashableT1, S1] | dict_keys[S1, Any],
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Self: ...
@overload
def __new__(
cls,
data: (
Scalar
| _ListLike
| Mapping[HashableT1, Any]
| BaseGroupBy
| NaTType
| NAType
| None
) = ...,
index: Axes | None = ...,
*,
dtype: Dtype = ...,
name: Hashable = ...,
copy: bool = ...,
) -> Series: ...
@property
def hasnans(self) -> bool: ...
def div(
self,
other: num | _ListLike | Series[S1],
level: Level | None = ...,
fill_value: float | None = ...,
axis: AxisIndex = ...,
) -> Series[float]: ...
def rdiv(
self,
other: Series[S1] | Scalar,
level: Level | None = ...,
fill_value: float | None = ...,
axis: AxisIndex = ...,
) -> Series[S1]: ...
@property
def dtype(self) -> DtypeObj: ...
@property
def dtypes(self) -> DtypeObj: ...
@property
def name(self) -> Hashable | None: ...
@name.setter
def name(self, value: Hashable | None) -> None: ...
@property
def values(self) -> ArrayLike: ...
@property
def array(self) -> ExtensionArray: ...
def ravel(self, order: _str = ...) -> np.ndarray: ...
def __len__(self) -> int: ...
def view(self, dtype=...) -> Series[S1]: ...
def __array_ufunc__(self, ufunc: Callable, method: _str, *inputs, **kwargs): ...
def __array__(self, dtype=...) -> np.ndarray: ...
@property
def axes(self) -> list: ...
def take(
self, indices: Sequence, axis: AxisIndex = ..., **kwargs
) -> Series[S1]: ...
def __getattr__(self, name: _str) -> S1: ...
@overload
def __getitem__(
self,
idx: (
list[_str]
| Index
| Series[S1]
| slice
| MaskType
| tuple[Hashable | slice, ...]
),
) -> Self: ...
@overload
def __getitem__(self, idx: Scalar) -> S1: ...
def __setitem__(self, key, value) -> None: ...
@overload
def get(self, key: Hashable, default: None = ...) -> S1 | None: ...
@overload
def get(self, key: Hashable, default: S1) -> S1: ...
@overload
def get(self, key: Hashable, default: T) -> S1 | T: ...
def repeat(
self, repeats: int | list[int], axis: AxisIndex | None = ...
) -> Series[S1]: ...
@property
def index(self) -> Index | MultiIndex: ...
@index.setter
def index(self, idx: Index) -> None: ...
# TODO: combine Level | Sequence[Level] github.com/python/mypy/issues/14311
@overload
def reset_index(
self,
level: Sequence[Level] = ...,
*,
drop: Literal[False] = ...,
name: Level = ...,
inplace: Literal[False] = ...,
allow_duplicates: bool = ...,
) -> DataFrame: ...
@overload
def reset_index(
self,
level: Sequence[Level] = ...,
*,
drop: Literal[True],
name: Level = ...,
inplace: Literal[False] = ...,
allow_duplicates: bool = ...,
) -> Series[S1]: ...
@overload
def reset_index(
self,
level: Sequence[Level] = ...,
*,
drop: bool = ...,
name: Level = ...,
inplace: Literal[True],
allow_duplicates: bool = ...,
) -> None: ...
@overload
def reset_index(
self,
level: Level | None = ...,
*,
drop: Literal[False] = ...,
name: Level = ...,
inplace: Literal[False] = ...,
allow_duplicates: bool = ...,
) -> DataFrame: ...
@overload
def reset_index(
self,
level: Level | None = ...,
*,
drop: Literal[True],
name: Level = ...,
inplace: Literal[False] = ...,
allow_duplicates: bool = ...,
) -> Series[S1]: ...
@overload
def reset_index(
self,
level: Level | None = ...,
*,
drop: bool = ...,
name: Level = ...,
inplace: Literal[True],
allow_duplicates: bool = ...,
) -> None: ...
@overload
def to_string(
self,
buf: FilePath | WriteBuffer[str],
na_rep: _str = ...,
float_format: Callable[[float], str] = ...,
header: _bool = ...,
index: _bool = ...,
length: _bool = ...,
dtype: _bool = ...,
name: _bool = ...,
max_rows: int | None = ...,
min_rows: int | None = ...,
) -> None: ...
@overload
def to_string(
self,
buf: None = ...,
na_rep: _str = ...,
float_format: Callable[[float], str] = ...,
header: _bool = ...,
index: _bool = ...,
length: _bool = ...,
dtype: _bool = ...,
name: _bool = ...,
max_rows: int | None = ...,
min_rows: int | None = ...,
) -> _str: ...
@overload
def to_json(
self,
path_or_buf: FilePath | WriteBuffer[str],
*,
orient: Literal["records"],
date_format: Literal["epoch", "iso"] | None = ...,
double_precision: int = ...,
force_ascii: _bool = ...,
date_unit: TimeUnit = ...,
default_handler: (
Callable[[Any], _str | float | _bool | list | dict] | None
) = ...,
lines: Literal[True],
compression: CompressionOptions = ...,
index: _bool = ...,
indent: int | None = ...,
mode: Literal["a"],
) -> None: ...
@overload
def to_json(
self,
path_or_buf: None = ...,
*,
orient: Literal["records"],
date_format: Literal["epoch", "iso"] | None = ...,
double_precision: int = ...,
force_ascii: _bool = ...,
date_unit: TimeUnit = ...,
default_handler: (
Callable[[Any], _str | float | _bool | list | dict] | None
) = ...,
lines: Literal[True],
compression: CompressionOptions = ...,
index: _bool = ...,
indent: int | None = ...,
mode: Literal["a"],
) -> _str: ...
@overload
def to_json(
self,
path_or_buf: FilePath | WriteBuffer[str],
orient: JsonSeriesOrient | None = ...,
date_format: Literal["epoch", "iso"] | None = ...,
double_precision: int = ...,
force_ascii: _bool = ...,
date_unit: TimeUnit = ...,
default_handler: (
Callable[[Any], _str | float | _bool | list | dict] | None
) = ...,
lines: _bool = ...,
compression: CompressionOptions = ...,
index: _bool = ...,
indent: int | None = ...,
mode: Literal["w"] = ...,
) -> None: ...
@overload
def to_json(
self,
path_or_buf: None = ...,
orient: JsonSeriesOrient | None = ...,
date_format: Literal["epoch", "iso"] | None = ...,
double_precision: int = ...,
force_ascii: _bool = ...,
date_unit: TimeUnit = ...,
default_handler: (
Callable[[Any], _str | float | _bool | list | dict] | None
) = ...,
lines: _bool = ...,
compression: CompressionOptions = ...,
index: _bool = ...,
indent: int | None = ...,
mode: Literal["w"] = ...,
) -> _str: ...
def to_xarray(self) -> xr.DataArray: ...
def items(self) -> Iterable[tuple[Hashable, S1]]: ...
def keys(self) -> list: ...
@overload
def to_dict(self, *, into: type[dict] = ...) -> dict[Any, S1]: ...
@overload
def to_dict(
self, *, into: type[MutableMapping] | MutableMapping
) -> MutableMapping[Hashable, S1]: ...
def to_frame(self, name: object | None = ...) -> DataFrame: ...
@overload
def groupby(
self,
by: Scalar,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Scalar]: ...
@overload
def groupby(
self,
by: DatetimeIndex,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Timestamp]: ...
@overload
def groupby(
self,
by: TimedeltaIndex,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Timedelta]: ...
@overload
def groupby(
self,
by: PeriodIndex,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Period]: ...
@overload
def groupby(
self,
by: IntervalIndex[IntervalT],
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, IntervalT]: ...
@overload
def groupby(
self,
by: MultiIndex | GroupByObjectNonScalar,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, tuple]: ...
@overload
def groupby(
self,
by: None,
axis: AxisIndex,
level: IndexLabel, # level is required when by=None (passed as positional)
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Scalar]: ...
@overload
def groupby(
self,
by: None = ...,
axis: AxisIndex = ...,
*,
level: IndexLabel, # level is required when by=None (passed as keyword)
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Scalar]: ...
@overload
def groupby(
self,
by: Series[SeriesByT],
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, SeriesByT]: ...
@overload
def groupby(
self,
by: CategoricalIndex | Index | Series,
axis: AxisIndex = ...,
level: IndexLabel | None = ...,
as_index: _bool = ...,
sort: _bool = ...,
group_keys: _bool = ...,
observed: _bool | NoDefault = ...,
dropna: _bool = ...,
) -> SeriesGroupBy[S1, Any]: ...
# need the ignore because None is Hashable
@overload
def count(self, level: None = ...) -> int: ... # type: ignore[overload-overlap]
@overload
def count(self, level: Hashable) -> Series[S1]: ...
def mode(self, dropna=...) -> Series[S1]: ...
def unique(self) -> np.ndarray: ...
@overload
def drop_duplicates(
self,
*,
keep: NaPosition | Literal[False] = ...,
inplace: Literal[True],
ignore_index: _bool = ...,
) -> None: ...
@overload
def drop_duplicates(
self,
*,
keep: NaPosition | Literal[False] = ...,
inplace: Literal[False] = ...,
ignore_index: _bool = ...,
) -> Series[S1]: ...
@overload
def drop_duplicates(
self,
*,
keep: NaPosition | Literal[False] = ...,
inplace: bool = ...,
ignore_index: _bool = ...,
) -> Series[S1] | None: ...
def duplicated(self, keep: NaPosition | Literal[False] = ...) -> Series[_bool]: ...
def idxmax(
self, axis: AxisIndex = ..., skipna: _bool = ..., *args, **kwargs
) -> int | _str: ...
def idxmin(
self, axis: AxisIndex = ..., skipna: _bool = ..., *args, **kwargs
) -> int | _str: ...
def round(self, decimals: int = ..., *args, **kwargs) -> Series[S1]: ...
@overload
def quantile(
self,
q: float = ...,
interpolation: QuantileInterpolation = ...,
) -> float: ...
@overload
def quantile(
self,
q: _ListLike,
interpolation: QuantileInterpolation = ...,
) -> Series[S1]: ...
def corr(
self,
other: Series[S1],
method: Literal["pearson", "kendall", "spearman"] = ...,
min_periods: int = ...,
) -> float: ...
def cov(
self, other: Series[S1], min_periods: int | None = ..., ddof: int = ...
) -> float: ...
@overload
def diff(self: Series[_bool], periods: int = ...) -> Series[type[object]]: ... # type: ignore[overload-overlap]
@overload
def diff(self: Series[complex], periods: int = ...) -> Series[complex]: ... # type: ignore[overload-overlap]
@overload
def diff(self: Series[bytes], periods: int = ...) -> Never: ...
@overload
def diff(self: Series[type], periods: int = ...) -> Never: ...
@overload
def diff(self: Series[str], periods: int = ...) -> Never: ...
@overload
def diff(self, periods: int = ...) -> Series[float]: ...
def autocorr(self, lag: int = ...) -> float: ...
@overload
def dot(self, other: Series[S1]) -> Scalar: ...
@overload
def dot(self, other: DataFrame) -> Series: ...
@overload
def dot(
self, other: ArrayLike | dict[_str, np.ndarray] | Sequence[S1] | Index[S1]
) -> np.ndarray: ...
@overload
def __matmul__(self, other: Series) -> Scalar: ...
@overload
def __matmul__(self, other: DataFrame) -> Series: ...
@overload
def __matmul__(self, other: np.ndarray) -> np.ndarray: ...
@overload
def __rmatmul__(self, other: Series) -> Scalar: ...
@overload
def __rmatmul__(self, other: DataFrame) -> Series: ...
@overload
def __rmatmul__(self, other: np.ndarray) -> np.ndarray: ...
@overload
def searchsorted(
self,
value: _ListLike,
side: Literal["left", "right"] = ...,
sorter: _ListLike | None = ...,
) -> list[int]: ...
@overload
def searchsorted(
self,
value: Scalar,
side: Literal["left", "right"] = ...,
sorter: _ListLike | None = ...,
) -> int: ...
@overload
def compare(
self,
other: Series,
align_axis: AxisIndex,
keep_shape: bool = ...,
keep_equal: bool = ...,
) -> Series: ...
@overload
def compare(
self,
other: Series,
align_axis: AxisColumn = ...,
keep_shape: bool = ...,
keep_equal: bool = ...,
) -> DataFrame: ...
def combine(
self, other: Series[S1], func: Callable, fill_value: Scalar | None = ...
) -> Series[S1]: ...
def combine_first(self, other: Series[S1]) -> Series[S1]: ...
def update(self, other: Series[S1] | Sequence[S1] | Mapping[int, S1]) -> None: ...
@overload
def sort_values(
self,
*,
axis: Axis = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
ignore_index: _bool = ...,
inplace: Literal[True],
key: Callable | None = ...,
) -> None: ...
@overload
def sort_values(
self,
*,
axis: Axis = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
ignore_index: _bool = ...,
inplace: Literal[False] = ...,
key: Callable | None = ...,
) -> Series[S1]: ...
@overload
def sort_values(
self,
*,
axis: Axis = ...,
ascending: _bool | Sequence[_bool] = ...,
inplace: _bool | None = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
ignore_index: _bool = ...,
key: Callable | None = ...,
) -> Series[S1] | None: ...
@overload
def sort_index(
self,
*,
axis: Axis = ...,
level: Level | None = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
sort_remaining: _bool = ...,
ignore_index: _bool = ...,
inplace: Literal[True],
key: Callable | None = ...,
) -> None: ...
@overload
def sort_index(
self,
*,
axis: Axis = ...,
level: Level | list[int] | list[_str] | None = ...,
ascending: _bool | Sequence[_bool] = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
sort_remaining: _bool = ...,
ignore_index: _bool = ...,
inplace: Literal[False] = ...,
key: Callable | None = ...,
) -> Self: ...
@overload
def sort_index(
self,
*,
axis: Axis = ...,
level: Level | list[int] | list[_str] | None = ...,
ascending: _bool | Sequence[_bool] = ...,
inplace: _bool | None = ...,
kind: SortKind = ...,
na_position: NaPosition = ...,
sort_remaining: _bool = ...,
ignore_index: _bool = ...,
key: Callable | None = ...,
) -> Series | None: ...
def argsort(
self,
axis: AxisIndex = ...,
kind: SortKind = ...,
order: None = ...,
) -> Series[int]: ...
def nlargest(
self, n: int = ..., keep: NaPosition | Literal["all"] = ...
) -> Series[S1]: ...
def nsmallest(
self, n: int = ..., keep: NaPosition | Literal["all"] = ...