Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
TomAugspurger committed Feb 9, 2018
1 parent f53652a commit 2425621
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,7 +927,7 @@ def try_timedelta(v):
# will try first with a string & object conversion
from pandas import to_timedelta
try:
return to_timedelta(v)._values.reshape(shape)
return to_timedelta(v)._ndarray_values.reshape(shape)
except Exception:
return v.reshape(shape)

Expand Down
13 changes: 1 addition & 12 deletions pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
from pandas._libs import index as libindex
from pandas._libs import join as libjoin

from pandas import compat
from pandas.compat.numpy import function as nv
Expand All @@ -9,8 +8,6 @@
from pandas.core.dtypes.common import (
is_categorical_dtype,
_ensure_platform_int,
_ensure_int32,
_ensure_int64,
is_list_like,
is_interval_dtype,
is_scalar)
Expand Down Expand Up @@ -217,14 +214,6 @@ def _shallow_copy(self, values=None, categories=None, ordered=None,
values=values, categories=categories,
ordered=ordered, **kwargs)

@cache_readonly
def _inner_indexer(self):
if self.codes.dtype.itemsize <= 4:
# int8, int16, int32
return libjoin.inner_join_indexer_int32
else:
return libjoin.inner_join_indexer_int64

def _is_dtype_compat(self, other):
"""
*this is an internal non-public method*
Expand All @@ -238,7 +227,7 @@ def _is_dtype_compat(self, other):
"""
if is_categorical_dtype(other):
if isinstance(other, CategoricalIndex):
other = other.values
other = other._values
if not other.is_dtype_equal(self):
raise TypeError("categories must match existing categories "
"when appending")
Expand Down
8 changes: 3 additions & 5 deletions pandas/core/indexes/multi.py
Original file line number Diff line number Diff line change
Expand Up @@ -2507,6 +2507,7 @@ def get_locs(self, seq):
MultiIndex.slice_locs : Get slice location given start label(s) and
end label(s).
"""
from .numeric import Int64Index

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

def _update_indexer(idxr, indexer=indexer):
Expand Down Expand Up @@ -2569,7 +2569,6 @@ def _update_indexer(idxr, indexer=indexer):
if indexers is not None:
indexer = _update_indexer(indexers, indexer=indexer)
else:
from .numeric import Int64Index
# no matches we are done
return Int64Index([])._ndarray_values

Expand Down Expand Up @@ -2652,9 +2651,8 @@ def equals(self, other):
for i in range(self.nlevels):
slabels = self.labels[i]
slabels = slabels[slabels != -1]
svalues = algos.take_nd(
np.asarray(self.levels[i]._values),
slabels, allow_fill=False)
svalues = algos.take_nd(np.asarray(self.levels[i]._values),
slabels, allow_fill=False)

olabels = other.labels[i]
olabels = olabels[olabels != -1]
Expand Down
5 changes: 0 additions & 5 deletions pandas/core/indexes/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@ def _int64index(self):
def values(self):
return self.astype(object).values

@property
def _values(self):
# TODO: return PeriodArray
return self.values

@property
def _ndarray_values(self):
# Ordinals
Expand Down

0 comments on commit 2425621

Please sign in to comment.