@@ -154,7 +154,7 @@ def make_empty(self, axes=None):
154
154
blocks = np .array ([], dtype = self .array_dtype )
155
155
else :
156
156
blocks = []
157
- return self . __class__ (blocks , axes )
157
+ return type ( self ) (blocks , axes )
158
158
159
159
def __nonzero__ (self ):
160
160
return True
@@ -435,7 +435,7 @@ def apply(
435
435
436
436
if len (result_blocks ) == 0 :
437
437
return self .make_empty (axes or self .axes )
438
- bm = self . __class__ (
438
+ bm = type ( self ) (
439
439
result_blocks , axes or self .axes , do_integrity_check = do_integrity_check
440
440
)
441
441
bm ._consolidate_inplace ()
@@ -524,7 +524,7 @@ def get_axe(block, qs, axes):
524
524
for b in blocks
525
525
]
526
526
527
- return self . __class__ (blocks , new_axes )
527
+ return type ( self ) (blocks , new_axes )
528
528
529
529
# single block, i.e. ndim == {1}
530
530
values = concat_compat ([b .values for b in blocks ])
@@ -634,7 +634,7 @@ def comp(s, regex=False):
634
634
rb = new_rb
635
635
result_blocks .extend (rb )
636
636
637
- bm = self . __class__ (result_blocks , self .axes )
637
+ bm = type ( self ) (result_blocks , self .axes )
638
638
bm ._consolidate_inplace ()
639
639
return bm
640
640
@@ -729,7 +729,7 @@ def combine(self, blocks, copy=True):
729
729
axes = list (self .axes )
730
730
axes [0 ] = self .items .take (indexer )
731
731
732
- return self . __class__ (new_blocks , axes , do_integrity_check = False )
732
+ return type ( self ) (new_blocks , axes , do_integrity_check = False )
733
733
734
734
def get_slice (self , slobj , axis = 0 ):
735
735
if axis >= self .ndim :
@@ -746,7 +746,7 @@ def get_slice(self, slobj, axis=0):
746
746
new_axes = list (self .axes )
747
747
new_axes [axis ] = new_axes [axis ][slobj ]
748
748
749
- bm = self . __class__ (new_blocks , new_axes , do_integrity_check = False )
749
+ bm = type ( self ) (new_blocks , new_axes , do_integrity_check = False )
750
750
bm ._consolidate_inplace ()
751
751
return bm
752
752
@@ -922,7 +922,7 @@ def consolidate(self):
922
922
if self .is_consolidated ():
923
923
return self
924
924
925
- bm = self . __class__ (self .blocks , self .axes )
925
+ bm = type ( self ) (self .blocks , self .axes )
926
926
bm ._is_consolidated = False
927
927
bm ._consolidate_inplace ()
928
928
return bm
@@ -1256,7 +1256,7 @@ def reindex_indexer(
1256
1256
1257
1257
new_axes = list (self .axes )
1258
1258
new_axes [axis ] = new_axis
1259
- return self . __class__ (new_blocks , new_axes )
1259
+ return type ( self ) (new_blocks , new_axes )
1260
1260
1261
1261
def _slice_take_blocks_ax0 (self , slice_or_indexer , fill_tuple = None ):
1262
1262
"""
@@ -1526,9 +1526,7 @@ def get_slice(self, slobj, axis=0):
1526
1526
if axis >= self .ndim :
1527
1527
raise IndexError ("Requested axis not found in manager" )
1528
1528
1529
- return self .__class__ (
1530
- self ._block ._slice (slobj ), self .index [slobj ], fastpath = True
1531
- )
1529
+ return type (self )(self ._block ._slice (slobj ), self .index [slobj ], fastpath = True )
1532
1530
1533
1531
@property
1534
1532
def index (self ):
0 commit comments