@@ -303,10 +303,6 @@ def getitem_block(self, slicer, new_mgr_locs=None):
303
303
def shape (self ):
304
304
return self .values .shape
305
305
306
- @property
307
- def itemsize (self ):
308
- return self .values .itemsize
309
-
310
306
@property
311
307
def dtype (self ):
312
308
return self .values .dtype
@@ -327,21 +323,6 @@ def concat_same_type(self, to_concat, placement=None):
327
323
return self .make_block_same_class (
328
324
values , placement = placement or slice (0 , len (values ), 1 ))
329
325
330
- def reindex_axis (self , indexer , method = None , axis = 1 , fill_value = None ,
331
- limit = None , mask_info = None ):
332
- """
333
- Reindex using pre-computed indexer information
334
- """
335
- if axis < 1 :
336
- raise AssertionError (
337
- 'axis must be at least 1, got {axis}' .format (axis = axis ))
338
- if fill_value is None :
339
- fill_value = self .fill_value
340
-
341
- new_values = algos .take_nd (self .values , indexer , axis ,
342
- fill_value = fill_value , mask_info = mask_info )
343
- return self .make_block (new_values )
344
-
345
326
def iget (self , i ):
346
327
return self .values [i ]
347
328
@@ -936,11 +917,8 @@ def putmask(self, mask, new, align=True, inplace=False, axis=0,
936
917
937
918
new_values = self .values if inplace else self .values .copy ()
938
919
939
- if hasattr (new , 'reindex_axis' ):
940
- new = new .values
941
-
942
- if hasattr (mask , 'reindex_axis' ):
943
- mask = mask .values
920
+ new = getattr (new , 'values' , new )
921
+ mask = getattr (mask , 'values' , mask )
944
922
945
923
# if we are passed a scalar None, convert it here
946
924
if not is_list_like (new ) and isna (new ) and not self .is_object :
@@ -1297,8 +1275,7 @@ def eval(self, func, other, errors='raise', try_cast=False, mgr=None):
1297
1275
orig_other = other
1298
1276
values = self .values
1299
1277
1300
- if hasattr (other , 'reindex_axis' ):
1301
- other = other .values
1278
+ other = getattr (other , 'values' , other )
1302
1279
1303
1280
# make sure that we can broadcast
1304
1281
is_transposed = False
@@ -1446,11 +1423,8 @@ def where(self, other, cond, align=True, errors='raise',
1446
1423
if transpose :
1447
1424
values = values .T
1448
1425
1449
- if hasattr (other , 'reindex_axis' ):
1450
- other = other .values
1451
-
1452
- if hasattr (cond , 'reindex_axis' ):
1453
- cond = cond .values
1426
+ other = getattr (other , 'values' , other )
1427
+ cond = getattr (cond , 'values' , cond )
1454
1428
1455
1429
# If the default broadcasting would go in the wrong direction, then
1456
1430
# explicitly reshape other instead
@@ -2630,9 +2604,8 @@ def external_values(self):
2630
2604
def get_values (self , dtype = None ):
2631
2605
# return object dtype as Timestamps with the zones
2632
2606
if is_object_dtype (dtype ):
2633
- f = lambda x : lib .Timestamp (x , tz = self .values .tz )
2634
2607
return lib .map_infer (
2635
- self .values .ravel (), f ).reshape (self .values .shape )
2608
+ self .values .ravel (), self . _box_func ).reshape (self .values .shape )
2636
2609
return self .values
2637
2610
2638
2611
def _slice (self , slicer ):
@@ -2760,10 +2733,6 @@ class SparseBlock(NonConsolidatableMixIn, Block):
2760
2733
def shape (self ):
2761
2734
return (len (self .mgr_locs ), self .sp_index .length )
2762
2735
2763
- @property
2764
- def itemsize (self ):
2765
- return self .dtype .itemsize
2766
-
2767
2736
@property
2768
2737
def fill_value (self ):
2769
2738
# return np.nan
@@ -2887,22 +2856,6 @@ def shift(self, periods, axis=0, mgr=None):
2887
2856
return [self .make_block_same_class (new_values ,
2888
2857
placement = self .mgr_locs )]
2889
2858
2890
- def reindex_axis (self , indexer , method = None , axis = 1 , fill_value = None ,
2891
- limit = None , mask_info = None ):
2892
- """
2893
- Reindex using pre-computed indexer information
2894
- """
2895
- if axis < 1 :
2896
- raise AssertionError (
2897
- 'axis must be at least 1, got {axis}' .format (axis = axis ))
2898
-
2899
- # taking on the 0th axis always here
2900
- if fill_value is None :
2901
- fill_value = self .fill_value
2902
- return self .make_block_same_class (self .values .take (indexer ),
2903
- fill_value = fill_value ,
2904
- placement = self .mgr_locs )
2905
-
2906
2859
def sparse_reindex (self , new_index ):
2907
2860
""" sparse reindex and return a new block
2908
2861
current reindex only works for float64 dtype! """
@@ -3324,7 +3277,7 @@ def apply(self, f, axes=None, filter=None, do_integrity_check=False,
3324
3277
3325
3278
aligned_args = dict ((k , kwargs [k ])
3326
3279
for k in align_keys
3327
- if hasattr (kwargs [k ], 'reindex_axis ' ))
3280
+ if hasattr (kwargs [k ], 'values ' ))
3328
3281
3329
3282
for b in self .blocks :
3330
3283
if filter is not None :
@@ -4552,10 +4505,6 @@ def asobject(self):
4552
4505
"""
4553
4506
return self ._block .get_values (dtype = object )
4554
4507
4555
- @property
4556
- def itemsize (self ):
4557
- return self ._block .values .itemsize
4558
-
4559
4508
@property
4560
4509
def _can_hold_na (self ):
4561
4510
return self ._block ._can_hold_na
0 commit comments