Skip to content

Commit 6ba65ca

Browse files
jbrockmendeljreback
authored andcommitted
CLN: Remove unused core.internals methods (pandas-dev#19250)
1 parent bcaa5da commit 6ba65ca

File tree

1 file changed

+7
-58
lines changed

1 file changed

+7
-58
lines changed

pandas/core/internals.py

+7-58
Original file line numberDiff line numberDiff line change
@@ -303,10 +303,6 @@ def getitem_block(self, slicer, new_mgr_locs=None):
303303
def shape(self):
304304
return self.values.shape
305305

306-
@property
307-
def itemsize(self):
308-
return self.values.itemsize
309-
310306
@property
311307
def dtype(self):
312308
return self.values.dtype
@@ -327,21 +323,6 @@ def concat_same_type(self, to_concat, placement=None):
327323
return self.make_block_same_class(
328324
values, placement=placement or slice(0, len(values), 1))
329325

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-
345326
def iget(self, i):
346327
return self.values[i]
347328

@@ -936,11 +917,8 @@ def putmask(self, mask, new, align=True, inplace=False, axis=0,
936917

937918
new_values = self.values if inplace else self.values.copy()
938919

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)
944922

945923
# if we are passed a scalar None, convert it here
946924
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):
12971275
orig_other = other
12981276
values = self.values
12991277

1300-
if hasattr(other, 'reindex_axis'):
1301-
other = other.values
1278+
other = getattr(other, 'values', other)
13021279

13031280
# make sure that we can broadcast
13041281
is_transposed = False
@@ -1446,11 +1423,8 @@ def where(self, other, cond, align=True, errors='raise',
14461423
if transpose:
14471424
values = values.T
14481425

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)
14541428

14551429
# If the default broadcasting would go in the wrong direction, then
14561430
# explicitly reshape other instead
@@ -2630,9 +2604,8 @@ def external_values(self):
26302604
def get_values(self, dtype=None):
26312605
# return object dtype as Timestamps with the zones
26322606
if is_object_dtype(dtype):
2633-
f = lambda x: lib.Timestamp(x, tz=self.values.tz)
26342607
return lib.map_infer(
2635-
self.values.ravel(), f).reshape(self.values.shape)
2608+
self.values.ravel(), self._box_func).reshape(self.values.shape)
26362609
return self.values
26372610

26382611
def _slice(self, slicer):
@@ -2760,10 +2733,6 @@ class SparseBlock(NonConsolidatableMixIn, Block):
27602733
def shape(self):
27612734
return (len(self.mgr_locs), self.sp_index.length)
27622735

2763-
@property
2764-
def itemsize(self):
2765-
return self.dtype.itemsize
2766-
27672736
@property
27682737
def fill_value(self):
27692738
# return np.nan
@@ -2887,22 +2856,6 @@ def shift(self, periods, axis=0, mgr=None):
28872856
return [self.make_block_same_class(new_values,
28882857
placement=self.mgr_locs)]
28892858

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-
29062859
def sparse_reindex(self, new_index):
29072860
""" sparse reindex and return a new block
29082861
current reindex only works for float64 dtype! """
@@ -3324,7 +3277,7 @@ def apply(self, f, axes=None, filter=None, do_integrity_check=False,
33243277

33253278
aligned_args = dict((k, kwargs[k])
33263279
for k in align_keys
3327-
if hasattr(kwargs[k], 'reindex_axis'))
3280+
if hasattr(kwargs[k], 'values'))
33283281

33293282
for b in self.blocks:
33303283
if filter is not None:
@@ -4552,10 +4505,6 @@ def asobject(self):
45524505
"""
45534506
return self._block.get_values(dtype=object)
45544507

4555-
@property
4556-
def itemsize(self):
4557-
return self._block.values.itemsize
4558-
45594508
@property
45604509
def _can_hold_na(self):
45614510
return self._block._can_hold_na

0 commit comments

Comments
 (0)