@@ -465,19 +465,6 @@ def to_native_types(self: T, **kwargs) -> T:
465
465
"""
466
466
return self .apply ("to_native_types" , ** kwargs )
467
467
468
- def is_consolidated (self ) -> bool :
469
- """
470
- Return True if more than one block with the same dtype
471
- """
472
- if not self ._known_consolidated :
473
- self ._consolidate_check ()
474
- return self ._is_consolidated
475
-
476
- def _consolidate_check (self ) -> None :
477
- dtypes = [blk .dtype for blk in self .blocks if blk ._can_consolidate ]
478
- self ._is_consolidated = len (dtypes ) == len (set (dtypes ))
479
- self ._known_consolidated = True
480
-
481
468
@property
482
469
def is_numeric_mixed_type (self ) -> bool :
483
470
return all (block .is_numeric for block in self .blocks )
@@ -623,13 +610,6 @@ def consolidate(self: T) -> T:
623
610
bm ._consolidate_inplace ()
624
611
return bm
625
612
626
- def _consolidate_inplace (self ) -> None :
627
- if not self .is_consolidated ():
628
- self .blocks = tuple (_consolidate (self .blocks ))
629
- self ._is_consolidated = True
630
- self ._known_consolidated = True
631
- self ._rebuild_blknos_and_blklocs ()
632
-
633
613
def reindex_indexer (
634
614
self : T ,
635
615
new_axis : Index ,
@@ -1551,6 +1531,29 @@ def _interleave(
1551
1531
1552
1532
return result
1553
1533
1534
+ # ----------------------------------------------------------------
1535
+ # Consolidation
1536
+
1537
+ def is_consolidated (self ) -> bool :
1538
+ """
1539
+ Return True if more than one block with the same dtype
1540
+ """
1541
+ if not self ._known_consolidated :
1542
+ self ._consolidate_check ()
1543
+ return self ._is_consolidated
1544
+
1545
+ def _consolidate_check (self ) -> None :
1546
+ dtypes = [blk .dtype for blk in self .blocks if blk ._can_consolidate ]
1547
+ self ._is_consolidated = len (dtypes ) == len (set (dtypes ))
1548
+ self ._known_consolidated = True
1549
+
1550
+ def _consolidate_inplace (self ) -> None :
1551
+ if not self .is_consolidated ():
1552
+ self .blocks = tuple (_consolidate (self .blocks ))
1553
+ self ._is_consolidated = True
1554
+ self ._known_consolidated = True
1555
+ self ._rebuild_blknos_and_blklocs ()
1556
+
1554
1557
1555
1558
class SingleBlockManager (BaseBlockManager , SingleDataManager ):
1556
1559
"""manage a single block with"""
@@ -1710,15 +1713,6 @@ def array_values(self):
1710
1713
def _can_hold_na (self ) -> bool :
1711
1714
return self ._block ._can_hold_na
1712
1715
1713
- def is_consolidated (self ) -> bool :
1714
- return True
1715
-
1716
- def _consolidate_check (self ):
1717
- pass
1718
-
1719
- def _consolidate_inplace (self ):
1720
- pass
1721
-
1722
1716
def idelete (self , indexer ) -> SingleBlockManager :
1723
1717
"""
1724
1718
Delete single location from SingleBlockManager.
0 commit comments