23
23
from pandas .core .common import (is_bool_indexer , _asarray_tuplesafe ,
24
24
is_null_slice , is_full_slice ,
25
25
_values_from_object )
26
+ from pandas ._libs .indexing import _NDFrameIndexerBase
26
27
27
28
28
29
# the supported indexers
@@ -85,19 +86,14 @@ class IndexingError(Exception):
85
86
pass
86
87
87
88
88
- class _NDFrameIndexer (object ):
89
+ class _NDFrameIndexer (_NDFrameIndexerBase ):
89
90
_valid_types = None
90
91
_exception = KeyError
91
92
axis = None
92
93
93
- def __init__ (self , obj , name ):
94
- self .obj = obj
95
- self .ndim = obj .ndim
96
- self .name = name
97
-
98
94
def __call__ (self , axis = None ):
99
95
# we need to return a copy of ourselves
100
- new_self = self .__class__ (self .obj , self .name )
96
+ new_self = self .__class__ (self .name , self .obj )
101
97
102
98
if axis is not None :
103
99
axis = self .obj ._get_axis_number (axis )
@@ -1321,7 +1317,7 @@ class _IXIndexer(_NDFrameIndexer):
1321
1317
1322
1318
"""
1323
1319
1324
- def __init__ (self , obj , name ):
1320
+ def __init__ (self , name , obj ):
1325
1321
1326
1322
_ix_deprecation_warning = textwrap .dedent ("""
1327
1323
.ix is deprecated. Please use
@@ -1332,8 +1328,8 @@ def __init__(self, obj, name):
1332
1328
http://pandas.pydata.org/pandas-docs/stable/indexing.html#ix-indexer-is-deprecated""" ) # noqa
1333
1329
1334
1330
warnings .warn (_ix_deprecation_warning ,
1335
- DeprecationWarning , stacklevel = 3 )
1336
- super (_IXIndexer , self ).__init__ (obj , name )
1331
+ DeprecationWarning , stacklevel = 2 )
1332
+ super (_IXIndexer , self ).__init__ (name , obj )
1337
1333
1338
1334
def _has_valid_type (self , key , axis ):
1339
1335
if isinstance (key , slice ):
0 commit comments