Skip to content

CLN: .values -> ._values #33713

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pandas/core/groupby/grouper.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,7 @@ def __init__(
self.name = grouper.name

if isinstance(grouper, MultiIndex):
self.grouper = grouper.values
self.grouper = grouper._values

# we have a single grouper which may be a myriad of things,
# some of which are dependent on the passing in level
Expand Down
24 changes: 12 additions & 12 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,22 +112,22 @@ def cmp_method(self, other):
if other.ndim > 0 and len(self) != len(other):
raise ValueError("Lengths must match to compare")

if is_object_dtype(self) and isinstance(other, ABCCategorical):
if is_object_dtype(self.dtype) and isinstance(other, ABCCategorical):
left = type(other)(self._values, dtype=other.dtype)
return op(left, other)
elif is_object_dtype(self) and isinstance(other, ExtensionArray):
elif is_object_dtype(self.dtype) and isinstance(other, ExtensionArray):
# e.g. PeriodArray
with np.errstate(all="ignore"):
result = op(self.values, other)
result = op(self._values, other)

elif is_object_dtype(self) and not isinstance(self, ABCMultiIndex):
elif is_object_dtype(self.dtype) and not isinstance(self, ABCMultiIndex):
# don't pass MultiIndex
with np.errstate(all="ignore"):
result = ops.comp_method_OBJECT_ARRAY(op, self.values, other)
result = ops.comp_method_OBJECT_ARRAY(op, self._values, other)

else:
with np.errstate(all="ignore"):
result = op(self.values, np.asarray(other))
result = op(self._values, np.asarray(other))

if is_bool_dtype(result):
return result
Expand Down Expand Up @@ -510,7 +510,7 @@ def _shallow_copy(self, values=None, name: Label = no_default):
name = self.name if name is no_default else name
cache = self._cache.copy() if values is None else {}
if values is None:
values = self.values
values = self._values

result = self._simple_new(values, name=name)
result._cache = cache
Expand Down Expand Up @@ -722,7 +722,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
indices = ensure_platform_int(indices)
if self._can_hold_na:
taken = self._assert_take_fillable(
self.values,
self._values,
indices,
allow_fill=allow_fill,
fill_value=fill_value,
Expand All @@ -734,7 +734,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
raise ValueError(
f"Unable to fill values because {cls_name} cannot contain NA"
)
taken = self.values.take(indices)
taken = self._values.take(indices)
return self._shallow_copy(taken)

def _assert_take_fillable(
Expand Down Expand Up @@ -1988,7 +1988,7 @@ def is_all_dates(self) -> bool:
"""
Whether or not the index values only consist of dates.
"""
return is_datetime_array(ensure_object(self.values))
return is_datetime_array(ensure_object(self._values))

# --------------------------------------------------------------------
# Pickle Methods
Expand Down Expand Up @@ -2339,13 +2339,13 @@ def _get_unique_index(self, dropna: bool = False):
if self.is_unique and not dropna:
return self

values = self.values

if not self.is_unique:
values = self.unique()
if not isinstance(self, ABCMultiIndex):
# extract an array to pass to _shallow_copy
values = values._data
else:
values = self._values

if dropna:
try:
Expand Down