@@ -1598,12 +1598,22 @@ def _replace_coerce(
1598
1598
return self
1599
1599
1600
1600
1601
- class NonConsolidatableMixIn :
1602
- """ hold methods for the nonconsolidatable blocks """
1601
+ class ExtensionBlock (Block ):
1602
+ """
1603
+ Block for holding extension types.
1604
+
1605
+ Notes
1606
+ -----
1607
+ This holds all 3rd-party extension array types. It's also the immediate
1608
+ parent class for our internal extension types' blocks, CategoricalBlock.
1609
+
1610
+ ExtensionArrays are limited to 1-D.
1611
+ """
1603
1612
1604
1613
_can_consolidate = False
1605
1614
_verify_integrity = False
1606
1615
_validate_ndim = False
1616
+ is_extension = True
1607
1617
1608
1618
def __init__ (self , values , placement , ndim = None ):
1609
1619
"""
@@ -1614,6 +1624,8 @@ def __init__(self, values, placement, ndim=None):
1614
1624
This will call continue to call __init__ for the other base
1615
1625
classes mixed in with this Mixin.
1616
1626
"""
1627
+ values = self ._maybe_coerce_values (values )
1628
+
1617
1629
# Placement must be converted to BlockPlacement so that we can check
1618
1630
# its length
1619
1631
if not isinstance (placement , libinternals .BlockPlacement ):
@@ -1627,6 +1639,10 @@ def __init__(self, values, placement, ndim=None):
1627
1639
ndim = 2
1628
1640
super ().__init__ (values , placement , ndim = ndim )
1629
1641
1642
+ if self .ndim == 2 and len (self .mgr_locs ) != 1 :
1643
+ # TODO(2DEA): check unnecessary with 2D EAs
1644
+ raise AssertionError ("block.size != values.size" )
1645
+
1630
1646
@property
1631
1647
def shape (self ):
1632
1648
if self .ndim == 1 :
@@ -1722,29 +1738,6 @@ def _get_unstack_items(self, unstacker, new_columns):
1722
1738
mask = mask .any (0 )
1723
1739
return new_placement , new_values , mask
1724
1740
1725
-
1726
- class ExtensionBlock (NonConsolidatableMixIn , Block ):
1727
- """
1728
- Block for holding extension types.
1729
-
1730
- Notes
1731
- -----
1732
- This holds all 3rd-party extension array types. It's also the immediate
1733
- parent class for our internal extension types' blocks, CategoricalBlock.
1734
-
1735
- ExtensionArrays are limited to 1-D.
1736
- """
1737
-
1738
- is_extension = True
1739
-
1740
- def __init__ (self , values , placement , ndim = None ):
1741
- values = self ._maybe_coerce_values (values )
1742
- super ().__init__ (values , placement , ndim )
1743
-
1744
- if self .ndim == 2 and len (self .mgr_locs ) != 1 :
1745
- # TODO(2DEA): check unnecessary with 2D EAs
1746
- raise AssertionError ("block.size != values.size" )
1747
-
1748
1741
def _maybe_coerce_values (self , values ):
1749
1742
"""
1750
1743
Unbox to an extension array.
0 commit comments