@@ -48,6 +48,11 @@ from pandas.core.dtypes.dtypes import (
4848
4949from pandas .io .formats .format import EngFormatter
5050
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+
5156ArrayLike : TypeAlias = ExtensionArray | np .ndarray
5257AnyArrayLike : TypeAlias = Index | Series | np .ndarray
5358PythonScalar : TypeAlias = str | bool | complex
@@ -80,6 +85,10 @@ class FulldatetimeDict(YearMonthDayDict, total=False):
8085 us : DatetimeDictArg
8186 ns : DatetimeDictArg
8287
88+ CorrelationMethod : TypeAlias = (
89+ Literal ["pearson" , "kendall" , "spearman" ]
90+ | Callable [[np .ndarray , np .ndarray ], float ]
91+ )
8392# dtypes
8493NpDtype : TypeAlias = str | np .dtype [np .generic ] | type [str | complex | bool | object ]
8594Dtype : TypeAlias = ExtensionDtype | NpDtype
@@ -444,6 +453,7 @@ class SequenceNotStr(Protocol[_T_co]):
444453IndexLabel : TypeAlias = Hashable | Sequence [Hashable ]
445454Label : TypeAlias = Hashable | None
446455Level : TypeAlias = Hashable | int
456+ Shape : TypeAlias = tuple [int , ...]
447457Suffixes : TypeAlias = tuple [str | None , str | None ]
448458Ordered : TypeAlias = bool | None
449459JSONSerializable : TypeAlias = PythonScalar | list | dict
@@ -469,8 +479,11 @@ AggFuncTypeSeriesToFrame: TypeAlias = list[AggFuncTypeBase] | AggFuncTypeDictSer
469479AggFuncTypeFrame : TypeAlias = (
470480 AggFuncTypeBase | list [AggFuncTypeBase ] | AggFuncTypeDictFrame
471481)
482+ AggFuncTypeDict : TypeAlias = AggFuncTypeDictSeries | AggFuncTypeDictFrame
483+ AggFuncType : TypeAlias = AggFuncTypeBase | list [AggFuncTypeBase ] | AggFuncTypeDict
472484
473485num : TypeAlias = complex
486+ AxisInt : TypeAlias = int
474487AxisIndex : TypeAlias = Literal ["index" , 0 ]
475488AxisColumn : TypeAlias = Literal ["columns" , 1 ]
476489Axis : TypeAlias = AxisIndex | AxisColumn
@@ -563,9 +576,12 @@ IndexT = TypeVar("IndexT", bound=Index)
563576IntervalT = TypeVar ("IntervalT" , bound = Interval )
564577IntervalClosedType : TypeAlias = Literal ["left" , "right" , "both" , "neither" ]
565578
579+ ScalarIndexer : TypeAlias = int | np .integer
580+ SequenceIndexer : TypeAlias = slice | list [int ] | np .ndarray
581+ PositionalIndexer : TypeAlias = ScalarIndexer | SequenceIndexer
566582TakeIndexer : TypeAlias = Sequence [int ] | Sequence [np .integer ] | npt .NDArray [np .integer ]
567583
568- IgnoreRaiseCoerce : TypeAlias = Literal ["ignore" , "raise" , "coerce" ]
584+ RaiseCoerce : TypeAlias = Literal ["raise" , "coerce" ]
569585
570586# Shared by functions such as drop and astype
571587IgnoreRaise : TypeAlias = Literal ["ignore" , "raise" ]
@@ -758,5 +774,10 @@ RandomState: TypeAlias = (
758774 | np .random .BitGenerator
759775 | np .random .RandomState
760776)
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+ )
761782
762783__all__ = ["npt" , "type_t" ]
0 commit comments