@@ -85,10 +85,13 @@ HashableT5 = TypeVar("HashableT5", bound=Hashable)
8585
8686# array-like
8787
88- ArrayLike : TypeAlias = ExtensionArray | np .ndarray
88+ ArrayLike : TypeAlias = ExtensionArray | np .ndarray [ tuple [ int ], np . dtype [ Any ]]
8989AnyArrayLike : TypeAlias = ArrayLike | Index | Series
9090AnyArrayLikeInt : TypeAlias = (
91- IntegerArray | Index [int ] | Series [int ] | npt .NDArray [np .integer ]
91+ IntegerArray
92+ | Index [int ]
93+ | Series [int ]
94+ | np .ndarray [tuple [int ], np .dtype [np .integer ]]
9295)
9396
9497# list-like
@@ -166,6 +169,7 @@ ToTimestampHow: TypeAlias = Literal["s", "e", "start", "end"]
166169NDFrameT = TypeVar ("NDFrameT" , bound = NDFrame )
167170
168171IndexT = TypeVar ("IndexT" , bound = Index )
172+ T_EXTENSION_ARRAY = TypeVar ("T_EXTENSION_ARRAY" , bound = ExtensionArray )
169173
170174# From _typing.py, not used here:
171175# FreqIndexT = TypeVar("FreqIndexT", "DatetimeIndex", "PeriodIndex", "TimedeltaIndex")
@@ -697,11 +701,15 @@ InterpolateOptions: TypeAlias = Literal[
697701# Using List[int] here rather than Sequence[int] to disallow tuples.
698702
699703ScalarIndexer : TypeAlias = int | np .integer
700- SequenceIndexer : TypeAlias = slice | list [int ] | np .ndarray
704+ SequenceIndexer : TypeAlias = (
705+ slice | list [int ] | np .ndarray [tuple [int ], np .dtype [np .intp ]]
706+ )
701707PositionalIndexer : TypeAlias = ScalarIndexer | SequenceIndexer
702708PositionalIndexerTuple : TypeAlias = tuple [PositionalIndexer , PositionalIndexer ]
703709# PositionalIndexer2D = Union[PositionalIndexer, PositionalIndexerTuple] Not used in stubs
704- TakeIndexer : TypeAlias = Sequence [int ] | Sequence [np .integer ] | npt .NDArray [np .integer ]
710+ TakeIndexer : TypeAlias = (
711+ Sequence [int | np .integer ] | np .ndarray [tuple [int ], np .dtype [np .integer ]]
712+ )
705713
706714# Shared by functions such as drop and astype
707715IgnoreRaise : TypeAlias = Literal ["ignore" , "raise" ]
@@ -832,18 +840,6 @@ SliceType: TypeAlias = Hashable | None
832840## All types below this point are only used in pandas-stubs
833841######
834842
835- num : TypeAlias = complex
836-
837- DtypeNp = TypeVar ("DtypeNp" , bound = np .dtype [np .generic ])
838- KeysArgType : TypeAlias = Any
839- ListLikeT = TypeVar ("ListLikeT" , bound = ListLike )
840- ListLikeExceptSeriesAndStr : TypeAlias = (
841- MutableSequence [Any ] | np .ndarray | tuple [Any , ...] | Index
842- )
843- ListLikeU : TypeAlias = Sequence | np .ndarray | Series | Index
844- ListLikeHashable : TypeAlias = (
845- MutableSequence [HashableT ] | np .ndarray | tuple [HashableT , ...] | range
846- )
847843StrLike : TypeAlias = str | np .str_
848844
849845ScalarT = TypeVar ("ScalarT" , bound = Scalar )
@@ -871,6 +867,17 @@ np_ndarray: TypeAlias = np.ndarray[ShapeT, np.dtype[GenericT]]
871867np_1darray : TypeAlias = np .ndarray [tuple [int ], np .dtype [GenericT ]]
872868np_2darray : TypeAlias = np .ndarray [tuple [int , int ], np .dtype [GenericT ]]
873869
870+ DtypeNp = TypeVar ("DtypeNp" , bound = np .dtype [np .generic ])
871+ KeysArgType : TypeAlias = Any
872+ ListLikeT = TypeVar ("ListLikeT" , bound = ListLike )
873+ ListLikeExceptSeriesAndStr : TypeAlias = (
874+ MutableSequence [Any ] | np_1darray [Any ] | tuple [Any , ...] | Index
875+ )
876+ ListLikeU : TypeAlias = Sequence | np_1darray [Any ] | Series | Index
877+ ListLikeHashable : TypeAlias = (
878+ MutableSequence [HashableT ] | np_1darray [Any ] | tuple [HashableT , ...] | range
879+ )
880+
874881class SupportsDType (Protocol [GenericT_co ]):
875882 @property
876883 def dtype (self ) -> np .dtype [GenericT_co ]: ...
0 commit comments