@@ -20,8 +20,11 @@ import numpy as np
2020from pandas .core .arraylike import OpsMixin
2121from pandas .core .arrays import ExtensionArray
2222from pandas .core .arrays .categorical import Categorical
23+ from pandas .core .arrays .integer import IntegerArray
24+ from pandas .core .arrays .timedeltas import TimedeltaArray
2325from pandas .core .indexes .accessors import ArrayDescriptor
2426from pandas .core .indexes .base import Index
27+ from pandas .core .indexes .timedeltas import TimedeltaIndex
2528from pandas .core .series import Series
2629from typing_extensions import Self
2730
@@ -40,10 +43,12 @@ from pandas._typing import (
4043 Scalar ,
4144 SupportsDType ,
4245 np_1darray ,
46+ np_ndarray ,
4347 np_ndarray_anyint ,
4448 np_ndarray_bool ,
4549 np_ndarray_complex ,
4650 np_ndarray_float ,
51+ np_ndarray_td ,
4752)
4853from pandas .util ._decorators import cache_readonly
4954
@@ -168,7 +173,82 @@ class IndexOpsMixin(OpsMixin, Generic[S1, GenericT_co]):
168173 ) -> np .intp : ...
169174 def drop_duplicates (self , * , keep : DropKeep = ...) -> Self : ...
170175
171- NumListLike : TypeAlias = (
176+ ScalarArrayIndexJustInt : TypeAlias = (
177+ Just [int ]
178+ | np .integer
179+ | Sequence [Just [int ] | np .integer ]
180+ | np_ndarray_anyint
181+ | IntegerArray
182+ | Index [int ]
183+ )
184+ ScalarArraySeriesJustInt : TypeAlias = ScalarArrayIndexJustInt | Series [int ]
185+ ScalarArrayIndexJustFloat : TypeAlias = (
186+ Just [float ]
187+ | np .floating
188+ | Sequence [Just [float ] | np .floating ]
189+ | np_ndarray_float
190+ # | FloatingArray # TODO: after pandas-dev/pandas-stubs#1469
191+ | Index [float ]
192+ )
193+ ScalarArraySeriesJustFloat : TypeAlias = ScalarArrayIndexJustFloat | Series [float ]
194+ ScalarArrayIndexJustComplex : TypeAlias = (
195+ Just [complex ]
196+ | np .complexfloating
197+ | Sequence [Just [complex ] | np .complexfloating ]
198+ | np_ndarray_complex
199+ | Index [complex ]
200+ )
201+ ScalarArraySeriesJustComplex : TypeAlias = ScalarArrayIndexJustComplex | Series [complex ]
202+
203+ ScalarArrayIndexIntNoBool : TypeAlias = (
204+ Just [int ]
205+ | np .integer
206+ | Sequence [int | np .integer ]
207+ | np_ndarray_anyint
208+ | IntegerArray
209+ | Index [int ]
210+ )
211+ ScalarArraySeriesIntNoBool : TypeAlias = ScalarArrayIndexIntNoBool | Series [int ]
212+
213+ NumpyRealScalar : TypeAlias = np .bool | np .integer | np .floating
214+ IndexReal : TypeAlias = Index [bool ] | Index [int ] | Index [float ]
215+ ScalarArrayIndexReal : TypeAlias = (
216+ float
217+ | Sequence [float | NumpyRealScalar ]
218+ | NumpyRealScalar
219+ | np_ndarray [tuple [int , ...], NumpyRealScalar ]
220+ | ExtensionArray
221+ | IndexReal
222+ )
223+ SeriesReal : TypeAlias = Series [bool ] | Series [int ] | Series [float ]
224+ ScalarArrayIndexSeriesReal : TypeAlias = ScalarArrayIndexReal | SeriesReal
225+
226+ NumpyComplexScalar : TypeAlias = NumpyRealScalar | np .complexfloating
227+ IndexComplex : TypeAlias = IndexReal | Index [complex ]
228+ ScalarArrayIndexComplex : TypeAlias = (
229+ complex
230+ | Sequence [complex | NumpyComplexScalar ]
231+ | NumpyComplexScalar
232+ | np_ndarray [tuple [int , ...], NumpyComplexScalar ]
233+ | ExtensionArray
234+ | IndexComplex
235+ )
236+ SeriesComplex : TypeAlias = SeriesReal | Series [complex ]
237+ ScalarArrayIndexSeriesComplex : TypeAlias = ScalarArrayIndexComplex | SeriesComplex
238+
239+ ArrayIndexTimedeltaNoSeq : TypeAlias = np_ndarray_td | TimedeltaArray | TimedeltaIndex
240+ ScalarArrayIndexTimedelta : TypeAlias = (
241+ timedelta
242+ | np .timedelta64
243+ | Sequence [timedelta | np .timedelta64 ]
244+ | ArrayIndexTimedeltaNoSeq
245+ )
246+ ArrayIndexSeriesTimedeltaNoSeq : TypeAlias = ArrayIndexTimedeltaNoSeq | Series [Timedelta ]
247+ ScalarArrayIndexSeriesTimedelta : TypeAlias = (
248+ ScalarArrayIndexTimedelta | Series [Timedelta ]
249+ )
250+
251+ NumListLike : TypeAlias = ( # deprecated, do not use
172252 ExtensionArray
173253 | np_ndarray_bool
174254 | np_ndarray_anyint
0 commit comments