@@ -431,7 +431,7 @@ def __init__(
431
431
dtype = self ._validate_dtype (dtype )
432
432
433
433
if isinstance (data , DataFrame ):
434
- data = data ._data
434
+ data = data ._mgr
435
435
436
436
if isinstance (data , BlockManager ):
437
437
mgr = self ._init_mgr (
@@ -590,10 +590,10 @@ def _is_homogeneous_type(self) -> bool:
590
590
... "B": np.array([1, 2], dtype=np.int64)})._is_homogeneous_type
591
591
False
592
592
"""
593
- if self ._data .any_extension_types :
594
- return len ({block .dtype for block in self ._data .blocks }) == 1
593
+ if self ._mgr .any_extension_types :
594
+ return len ({block .dtype for block in self ._mgr .blocks }) == 1
595
595
else :
596
- return not self ._data .is_mixed_type
596
+ return not self ._mgr .is_mixed_type
597
597
598
598
# ----------------------------------------------------------------------
599
599
# Rendering Methods
@@ -2537,7 +2537,7 @@ def _ixs(self, i: int, axis: int = 0):
2537
2537
"""
2538
2538
# irow
2539
2539
if axis == 0 :
2540
- new_values = self ._data .fast_xs (i )
2540
+ new_values = self ._mgr .fast_xs (i )
2541
2541
2542
2542
# if we are a copy, mark as such
2543
2543
copy = isinstance (new_values , np .ndarray ) and new_values .base is None
@@ -2554,7 +2554,7 @@ def _ixs(self, i: int, axis: int = 0):
2554
2554
else :
2555
2555
label = self .columns [i ]
2556
2556
2557
- values = self ._data .iget (i )
2557
+ values = self ._mgr .iget (i )
2558
2558
result = self ._box_col_values (values , label )
2559
2559
2560
2560
# this is a cached value, mark it so
@@ -2865,7 +2865,7 @@ def _ensure_valid_index(self, value):
2865
2865
"and a value that cannot be converted to a Series"
2866
2866
) from err
2867
2867
2868
- self ._data = self ._data .reindex_axis (
2868
+ self ._mgr = self ._mgr .reindex_axis (
2869
2869
value .index .copy (), axis = 1 , fill_value = np .nan
2870
2870
)
2871
2871
@@ -3313,7 +3313,7 @@ def insert(self, loc, column, value, allow_duplicates=False) -> None:
3313
3313
"""
3314
3314
self ._ensure_valid_index (value )
3315
3315
value = self ._sanitize_column (column , value , broadcast = False )
3316
- self ._data .insert (loc , column , value , allow_duplicates = allow_duplicates )
3316
+ self ._mgr .insert (loc , column , value , allow_duplicates = allow_duplicates )
3317
3317
3318
3318
def assign (self , ** kwargs ) -> "DataFrame" :
3319
3319
r"""
@@ -3494,7 +3494,7 @@ def reindexer(value):
3494
3494
@property
3495
3495
def _series (self ):
3496
3496
return {
3497
- item : Series (self ._data .iget (idx ), index = self .index , name = item )
3497
+ item : Series (self ._mgr .iget (idx ), index = self .index , name = item )
3498
3498
for idx , item in enumerate (self .columns )
3499
3499
}
3500
3500
@@ -4403,7 +4403,7 @@ def _maybe_casted_values(index, labels=None):
4403
4403
values_dtype = values .dtype
4404
4404
4405
4405
if issubclass (values_type , DatetimeLikeArray ):
4406
- values = values ._data
4406
+ values = values ._data # TODO: can we de-kludge yet?
4407
4407
4408
4408
if mask .any ():
4409
4409
values , _ = maybe_upcast_putmask (values , mask , np .nan )
@@ -4787,7 +4787,7 @@ def sort_values(
4787
4787
k , kind = kind , ascending = ascending , na_position = na_position
4788
4788
)
4789
4789
4790
- new_data = self ._data .take (
4790
+ new_data = self ._mgr .take (
4791
4791
indexer , axis = self ._get_block_manager_axis (axis ), verify = False
4792
4792
)
4793
4793
@@ -4922,7 +4922,7 @@ def sort_index(
4922
4922
)
4923
4923
4924
4924
baxis = self ._get_block_manager_axis (axis )
4925
- new_data = self ._data .take (indexer , axis = baxis , verify = False )
4925
+ new_data = self ._mgr .take (indexer , axis = baxis , verify = False )
4926
4926
4927
4927
# reconstruct axis if needed
4928
4928
new_data .axes [baxis ] = new_data .axes [baxis ]._sort_levels_monotonic ()
@@ -6661,7 +6661,7 @@ def diff(self, periods: int = 1, axis: Axis = 0) -> "DataFrame":
6661
6661
5 NaN NaN NaN
6662
6662
"""
6663
6663
bm_axis = self ._get_block_manager_axis (axis )
6664
- new_data = self ._data .diff (n = periods , axis = bm_axis )
6664
+ new_data = self ._mgr .diff (n = periods , axis = bm_axis )
6665
6665
return self ._constructor (new_data )
6666
6666
6667
6667
# ----------------------------------------------------------------------
@@ -7855,7 +7855,7 @@ def count(self, axis=0, level=None, numeric_only=False):
7855
7855
if len (frame ._get_axis (axis )) == 0 :
7856
7856
result = Series (0 , index = frame ._get_agg_axis (axis ))
7857
7857
else :
7858
- if frame ._is_mixed_type or frame ._data .any_extension_types :
7858
+ if frame ._is_mixed_type or frame ._mgr .any_extension_types :
7859
7859
# the or any_extension_types is really only hit for single-
7860
7860
# column frames with an extension array
7861
7861
result = notna (frame ).sum (axis = axis )
@@ -7979,7 +7979,7 @@ def blk_func(values):
7979
7979
7980
7980
# After possibly _get_data and transposing, we are now in the
7981
7981
# simple case where we can use BlockManager._reduce
7982
- res = df ._data .reduce (blk_func )
7982
+ res = df ._mgr .reduce (blk_func )
7983
7983
assert isinstance (res , dict )
7984
7984
if len (res ):
7985
7985
assert len (res ) == max (list (res .keys ())) + 1 , res .keys ()
@@ -8421,7 +8421,7 @@ def quantile(self, q=0.5, axis=0, numeric_only=True, interpolation="linear"):
8421
8421
return self ._constructor ([], index = q , columns = cols )
8422
8422
return self ._constructor_sliced ([], index = cols , name = q , dtype = np .float64 )
8423
8423
8424
- result = data ._data .quantile (
8424
+ result = data ._mgr .quantile (
8425
8425
qs = q , axis = 1 , interpolation = interpolation , transposed = is_transposed
8426
8426
)
8427
8427
0 commit comments