9
9
from pandas .errors import AbstractMethodError
10
10
from pandas .util ._decorators import cache_readonly , doc
11
11
12
- from pandas .core .dtypes .common import (
13
- ensure_platform_int ,
14
- is_dtype_equal ,
15
- is_object_dtype ,
16
- )
12
+ from pandas .core .dtypes .common import is_dtype_equal , is_object_dtype
17
13
from pandas .core .dtypes .generic import ABCSeries
18
14
19
15
from pandas .core .arrays import ExtensionArray
@@ -223,29 +219,14 @@ def __getitem__(self, key):
223
219
deprecate_ndim_indexing (result )
224
220
return result
225
221
226
- def __iter__ (self ):
227
- return self ._data .__iter__ ()
228
-
229
222
# ---------------------------------------------------------------------
230
223
231
- def __array__ (self , dtype = None ) -> np .ndarray :
232
- return np .asarray (self ._data , dtype = dtype )
233
-
234
224
def _get_engine_target (self ) -> np .ndarray :
235
225
# NB: _values_for_argsort happens to match the desired engine targets
236
226
# for all of our existing EA-backed indexes, but in general
237
227
# cannot be relied upon to exist.
238
228
return self ._data ._values_for_argsort ()
239
229
240
- @doc (Index .dropna )
241
- def dropna (self , how = "any" ):
242
- if how not in ("any" , "all" ):
243
- raise ValueError (f"invalid how option: { how } " )
244
-
245
- if self .hasnans :
246
- return self ._shallow_copy (self ._data [~ self ._isnan ])
247
- return self ._shallow_copy ()
248
-
249
230
def repeat (self , repeats , axis = None ):
250
231
nv .validate_repeat (tuple (), dict (axis = axis ))
251
232
result = self ._data .repeat (repeats , axis = axis )
@@ -259,27 +240,6 @@ def _concat_same_dtype(self, to_concat, name):
259
240
arr = type (self ._data )._concat_same_type (to_concat )
260
241
return type (self )._simple_new (arr , name = name )
261
242
262
- @doc (Index .take )
263
- def take (self , indices , axis = 0 , allow_fill = True , fill_value = None , ** kwargs ):
264
- nv .validate_take (tuple (), kwargs )
265
- indices = ensure_platform_int (indices )
266
-
267
- taken = self ._assert_take_fillable (
268
- self ._data ,
269
- indices ,
270
- allow_fill = allow_fill ,
271
- fill_value = fill_value ,
272
- na_value = self ._na_value ,
273
- )
274
- return type (self )(taken , name = self .name )
275
-
276
- def unique (self , level = None ):
277
- if level is not None :
278
- self ._validate_index_level (level )
279
-
280
- result = self ._data .unique ()
281
- return self ._shallow_copy (result )
282
-
283
243
def _get_unique_index (self , dropna = False ):
284
244
if self .is_unique and not dropna :
285
245
return self
0 commit comments