Skip to content

Commit 2425621

Browse files
committed
cleanup
1 parent f53652a commit 2425621

File tree

4 files changed

+5
-23
lines changed

4 files changed

+5
-23
lines changed

pandas/core/dtypes/cast.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -927,7 +927,7 @@ def try_timedelta(v):
927927
# will try first with a string & object conversion
928928
from pandas import to_timedelta
929929
try:
930-
return to_timedelta(v)._values.reshape(shape)
930+
return to_timedelta(v)._ndarray_values.reshape(shape)
931931
except Exception:
932932
return v.reshape(shape)
933933

pandas/core/indexes/category.py

+1-12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import numpy as np
22
from pandas._libs import index as libindex
3-
from pandas._libs import join as libjoin
43

54
from pandas import compat
65
from pandas.compat.numpy import function as nv
@@ -9,8 +8,6 @@
98
from pandas.core.dtypes.common import (
109
is_categorical_dtype,
1110
_ensure_platform_int,
12-
_ensure_int32,
13-
_ensure_int64,
1411
is_list_like,
1512
is_interval_dtype,
1613
is_scalar)
@@ -217,14 +214,6 @@ def _shallow_copy(self, values=None, categories=None, ordered=None,
217214
values=values, categories=categories,
218215
ordered=ordered, **kwargs)
219216

220-
@cache_readonly
221-
def _inner_indexer(self):
222-
if self.codes.dtype.itemsize <= 4:
223-
# int8, int16, int32
224-
return libjoin.inner_join_indexer_int32
225-
else:
226-
return libjoin.inner_join_indexer_int64
227-
228217
def _is_dtype_compat(self, other):
229218
"""
230219
*this is an internal non-public method*
@@ -238,7 +227,7 @@ def _is_dtype_compat(self, other):
238227
"""
239228
if is_categorical_dtype(other):
240229
if isinstance(other, CategoricalIndex):
241-
other = other.values
230+
other = other._values
242231
if not other.is_dtype_equal(self):
243232
raise TypeError("categories must match existing categories "
244233
"when appending")

pandas/core/indexes/multi.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -2507,6 +2507,7 @@ def get_locs(self, seq):
25072507
MultiIndex.slice_locs : Get slice location given start label(s) and
25082508
end label(s).
25092509
"""
2510+
from .numeric import Int64Index
25102511

25112512
# must be lexsorted to at least as many levels
25122513
true_slices = [i for (i, s) in enumerate(com.is_true_slices(seq)) if s]
@@ -2532,7 +2533,6 @@ def _convert_to_indexer(r):
25322533
"that is not the same length as the "
25332534
"index")
25342535
r = r.nonzero()[0]
2535-
from .numeric import Int64Index
25362536
return Int64Index(r)
25372537

25382538
def _update_indexer(idxr, indexer=indexer):
@@ -2569,7 +2569,6 @@ def _update_indexer(idxr, indexer=indexer):
25692569
if indexers is not None:
25702570
indexer = _update_indexer(indexers, indexer=indexer)
25712571
else:
2572-
from .numeric import Int64Index
25732572
# no matches we are done
25742573
return Int64Index([])._ndarray_values
25752574

@@ -2652,9 +2651,8 @@ def equals(self, other):
26522651
for i in range(self.nlevels):
26532652
slabels = self.labels[i]
26542653
slabels = slabels[slabels != -1]
2655-
svalues = algos.take_nd(
2656-
np.asarray(self.levels[i]._values),
2657-
slabels, allow_fill=False)
2654+
svalues = algos.take_nd(np.asarray(self.levels[i]._values),
2655+
slabels, allow_fill=False)
26582656

26592657
olabels = other.labels[i]
26602658
olabels = olabels[olabels != -1]

pandas/core/indexes/period.py

-5
Original file line numberDiff line numberDiff line change
@@ -418,11 +418,6 @@ def _int64index(self):
418418
def values(self):
419419
return self.astype(object).values
420420

421-
@property
422-
def _values(self):
423-
# TODO: return PeriodArray
424-
return self.values
425-
426421
@property
427422
def _ndarray_values(self):
428423
# Ordinals

0 commit comments

Comments
 (0)