@@ -62,9 +62,7 @@ class Block(PandasObject):
62
62
is_bool = False
63
63
is_object = False
64
64
is_categorical = False
65
- is_sparse = False
66
65
is_extension = False
67
- _box_to_block_values = True
68
66
_can_hold_na = False
69
67
_can_consolidate = True
70
68
_verify_integrity = True
@@ -182,10 +180,6 @@ def get_values(self, dtype=None):
182
180
def to_dense (self ):
183
181
return self .values .view ()
184
182
185
- @property
186
- def _na_value (self ):
187
- return np .nan
188
-
189
183
@property
190
184
def fill_value (self ):
191
185
return np .nan
@@ -1189,8 +1183,6 @@ def take_nd(self, indexer, axis, new_mgr_locs=None, fill_tuple=None):
1189
1183
# sparse is treated like an ndarray, but needs .get_values() shaping
1190
1184
1191
1185
values = self .values
1192
- if self .is_sparse :
1193
- values = self .get_values ()
1194
1186
1195
1187
if fill_tuple is None :
1196
1188
fill_value = self .fill_value
@@ -1411,6 +1403,9 @@ def quantile(self, qs, interpolation='linear', axis=0):
1411
1403
-------
1412
1404
Block
1413
1405
"""
1406
+ # We should always have ndim == 2 becase Series dispatches to DataFrame
1407
+ assert self .ndim == 2
1408
+
1414
1409
if self .is_datetimetz :
1415
1410
# TODO: cleanup this special case.
1416
1411
# We need to operate on i8 values for datetimetz
@@ -1420,8 +1415,7 @@ def quantile(self, qs, interpolation='linear', axis=0):
1420
1415
1421
1416
# TODO: NonConsolidatableMixin shape
1422
1417
# Usual shape inconsistencies for ExtensionBlocks
1423
- if self .ndim > 1 :
1424
- values = values [None , :]
1418
+ values = values [None , :]
1425
1419
else :
1426
1420
values = self .get_values ()
1427
1421
values , _ = self ._try_coerce_args (values , values )
@@ -1433,14 +1427,11 @@ def quantile(self, qs, interpolation='linear', axis=0):
1433
1427
qs = [qs ]
1434
1428
1435
1429
if is_empty :
1436
- if self .ndim == 1 :
1437
- result = self ._na_value
1438
- else :
1439
- # create the array of na_values
1440
- # 2d len(values) * len(qs)
1441
- result = np .repeat (np .array ([self .fill_value ] * len (qs )),
1442
- len (values )).reshape (len (values ),
1443
- len (qs ))
1430
+ # create the array of na_values
1431
+ # 2d len(values) * len(qs)
1432
+ result = np .repeat (np .array ([self .fill_value ] * len (qs )),
1433
+ len (values )).reshape (len (values ),
1434
+ len (qs ))
1444
1435
else :
1445
1436
# asarray needed for Sparse, see GH#24600
1446
1437
# TODO: Why self.values and not values?
@@ -1451,8 +1442,7 @@ def quantile(self, qs, interpolation='linear', axis=0):
1451
1442
interpolation = interpolation )
1452
1443
1453
1444
result = np .array (result , copy = False )
1454
- if self .ndim > 1 :
1455
- result = result .T
1445
+ result = result .T
1456
1446
1457
1447
if orig_scalar and not lib .is_scalar (result ):
1458
1448
# result could be scalar in case with is_empty and self.ndim == 1
@@ -2024,10 +2014,6 @@ class DatetimeLikeBlockMixin:
2024
2014
def _holder (self ):
2025
2015
return DatetimeArray
2026
2016
2027
- @property
2028
- def _na_value (self ):
2029
- return tslibs .NaT
2030
-
2031
2017
@property
2032
2018
def fill_value (self ):
2033
2019
return tslibs .iNaT
0 commit comments