@@ -153,7 +153,7 @@ def make_empty(self, axes=None):
153
153
blocks = np .array ([], dtype = self .array_dtype )
154
154
else :
155
155
blocks = []
156
- return self . __class__ (blocks , axes )
156
+ return type ( self ) (blocks , axes )
157
157
158
158
def __nonzero__ (self ):
159
159
return True
@@ -316,7 +316,7 @@ def __len__(self) -> int:
316
316
return len (self .items )
317
317
318
318
def __repr__ (self ) -> str :
319
- output = pprint_thing (self . __class__ . __name__ )
319
+ output = type (self ). __name__
320
320
for i , ax in enumerate (self .axes ):
321
321
if i == 0 :
322
322
output += "\n Items: {ax}" .format (ax = ax )
@@ -430,7 +430,7 @@ def apply(
430
430
431
431
if len (result_blocks ) == 0 :
432
432
return self .make_empty (axes or self .axes )
433
- bm = self . __class__ (
433
+ bm = type ( self ) (
434
434
result_blocks , axes or self .axes , do_integrity_check = do_integrity_check
435
435
)
436
436
bm ._consolidate_inplace ()
@@ -519,7 +519,7 @@ def get_axe(block, qs, axes):
519
519
for b in blocks
520
520
]
521
521
522
- return self . __class__ (blocks , new_axes )
522
+ return type ( self ) (blocks , new_axes )
523
523
524
524
# single block, i.e. ndim == {1}
525
525
values = concat_compat ([b .values for b in blocks ])
@@ -629,7 +629,7 @@ def comp(s, regex=False):
629
629
rb = new_rb
630
630
result_blocks .extend (rb )
631
631
632
- bm = self . __class__ (result_blocks , self .axes )
632
+ bm = type ( self ) (result_blocks , self .axes )
633
633
bm ._consolidate_inplace ()
634
634
return bm
635
635
@@ -724,7 +724,7 @@ def combine(self, blocks, copy=True):
724
724
axes = list (self .axes )
725
725
axes [0 ] = self .items .take (indexer )
726
726
727
- return self . __class__ (new_blocks , axes , do_integrity_check = False )
727
+ return type ( self ) (new_blocks , axes , do_integrity_check = False )
728
728
729
729
def get_slice (self , slobj , axis = 0 ):
730
730
if axis >= self .ndim :
@@ -741,7 +741,7 @@ def get_slice(self, slobj, axis=0):
741
741
new_axes = list (self .axes )
742
742
new_axes [axis ] = new_axes [axis ][slobj ]
743
743
744
- bm = self . __class__ (new_blocks , new_axes , do_integrity_check = False )
744
+ bm = type ( self ) (new_blocks , new_axes , do_integrity_check = False )
745
745
bm ._consolidate_inplace ()
746
746
return bm
747
747
@@ -917,7 +917,7 @@ def consolidate(self):
917
917
if self .is_consolidated ():
918
918
return self
919
919
920
- bm = self . __class__ (self .blocks , self .axes )
920
+ bm = type ( self ) (self .blocks , self .axes )
921
921
bm ._is_consolidated = False
922
922
bm ._consolidate_inplace ()
923
923
return bm
@@ -1251,7 +1251,7 @@ def reindex_indexer(
1251
1251
1252
1252
new_axes = list (self .axes )
1253
1253
new_axes [axis ] = new_axis
1254
- return self . __class__ (new_blocks , new_axes )
1254
+ return type ( self ) (new_blocks , new_axes )
1255
1255
1256
1256
def _slice_take_blocks_ax0 (self , slice_or_indexer , fill_tuple = None ):
1257
1257
"""
@@ -1521,9 +1521,7 @@ def get_slice(self, slobj, axis=0):
1521
1521
if axis >= self .ndim :
1522
1522
raise IndexError ("Requested axis not found in manager" )
1523
1523
1524
- return self .__class__ (
1525
- self ._block ._slice (slobj ), self .index [slobj ], fastpath = True
1526
- )
1524
+ return type (self )(self ._block ._slice (slobj ), self .index [slobj ], fastpath = True )
1527
1525
1528
1526
@property
1529
1527
def index (self ):
0 commit comments