@@ -48,6 +48,11 @@ from pandas.core.dtypes.dtypes import (
48
48
49
49
from pandas .io .formats .format import EngFormatter
50
50
51
+ # `Incomplete` is equivalent to `Any`. Use it to annotate symbols that you don't
52
+ # know the type of yet and that should be changed in the future. Use `Any` only
53
+ # where it is the only acceptable type.
54
+ Incomplete : TypeAlias = Any
55
+
51
56
ArrayLike : TypeAlias = ExtensionArray | np .ndarray
52
57
AnyArrayLike : TypeAlias = Index | Series | np .ndarray
53
58
PythonScalar : TypeAlias = str | bool | complex
@@ -80,6 +85,10 @@ class FulldatetimeDict(YearMonthDayDict, total=False):
80
85
us : DatetimeDictArg
81
86
ns : DatetimeDictArg
82
87
88
+ CorrelationMethod : TypeAlias = (
89
+ Literal ["pearson" , "kendall" , "spearman" ]
90
+ | Callable [[np .ndarray , np .ndarray ], float ]
91
+ )
83
92
# dtypes
84
93
NpDtype : TypeAlias = str | np .dtype [np .generic ] | type [str | complex | bool | object ]
85
94
Dtype : TypeAlias = ExtensionDtype | NpDtype
@@ -444,6 +453,7 @@ class SequenceNotStr(Protocol[_T_co]):
444
453
IndexLabel : TypeAlias = Hashable | Sequence [Hashable ]
445
454
Label : TypeAlias = Hashable | None
446
455
Level : TypeAlias = Hashable | int
456
+ Shape : TypeAlias = tuple [int , ...]
447
457
Suffixes : TypeAlias = tuple [str | None , str | None ]
448
458
Ordered : TypeAlias = bool | None
449
459
JSONSerializable : TypeAlias = PythonScalar | list | dict
@@ -469,8 +479,11 @@ AggFuncTypeSeriesToFrame: TypeAlias = list[AggFuncTypeBase] | AggFuncTypeDictSer
469
479
AggFuncTypeFrame : TypeAlias = (
470
480
AggFuncTypeBase | list [AggFuncTypeBase ] | AggFuncTypeDictFrame
471
481
)
482
+ AggFuncTypeDict : TypeAlias = AggFuncTypeDictSeries | AggFuncTypeDictFrame
483
+ AggFuncType : TypeAlias = AggFuncTypeBase | list [AggFuncTypeBase ] | AggFuncTypeDict
472
484
473
485
num : TypeAlias = complex
486
+ AxisInt : TypeAlias = int
474
487
AxisIndex : TypeAlias = Literal ["index" , 0 ]
475
488
AxisColumn : TypeAlias = Literal ["columns" , 1 ]
476
489
Axis : TypeAlias = AxisIndex | AxisColumn
@@ -563,9 +576,12 @@ IndexT = TypeVar("IndexT", bound=Index)
563
576
IntervalT = TypeVar ("IntervalT" , bound = Interval )
564
577
IntervalClosedType : TypeAlias = Literal ["left" , "right" , "both" , "neither" ]
565
578
579
+ ScalarIndexer : TypeAlias = int | np .integer
580
+ SequenceIndexer : TypeAlias = slice | list [int ] | np .ndarray
581
+ PositionalIndexer : TypeAlias = ScalarIndexer | SequenceIndexer
566
582
TakeIndexer : TypeAlias = Sequence [int ] | Sequence [np .integer ] | npt .NDArray [np .integer ]
567
583
568
- IgnoreRaiseCoerce : TypeAlias = Literal ["ignore" , "raise" , "coerce" ]
584
+ RaiseCoerce : TypeAlias = Literal ["raise" , "coerce" ]
569
585
570
586
# Shared by functions such as drop and astype
571
587
IgnoreRaise : TypeAlias = Literal ["ignore" , "raise" ]
@@ -758,5 +774,10 @@ RandomState: TypeAlias = (
758
774
| np .random .BitGenerator
759
775
| np .random .RandomState
760
776
)
777
+ Frequency : TypeAlias = str | BaseOffset
778
+ TimeUnit : TypeAlias = Literal ["s" , "ms" , "us" , "ns" ]
779
+ TimeGrouperOrigin : TypeAlias = (
780
+ Timestamp | Literal ["epoch" , "start" , "start_day" , "end" , "end_day" ]
781
+ )
761
782
762
783
__all__ = ["npt" , "type_t" ]
0 commit comments