Skip to content

Commit 92354a8

Browse files
authored
CLN: .values -> ._values (#33713)
1 parent 8282ee2 commit 92354a8

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

pandas/core/groupby/grouper.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def __init__(
299299
self.name = grouper.name
300300

301301
if isinstance(grouper, MultiIndex):
302-
self.grouper = grouper.values
302+
self.grouper = grouper._values
303303

304304
# we have a single grouper which may be a myriad of things,
305305
# some of which are dependent on the passing in level

pandas/core/indexes/base.py

+12-12
Original file line numberDiff line numberDiff line change
@@ -112,22 +112,22 @@ def cmp_method(self, other):
112112
if other.ndim > 0 and len(self) != len(other):
113113
raise ValueError("Lengths must match to compare")
114114

115-
if is_object_dtype(self) and isinstance(other, ABCCategorical):
115+
if is_object_dtype(self.dtype) and isinstance(other, ABCCategorical):
116116
left = type(other)(self._values, dtype=other.dtype)
117117
return op(left, other)
118-
elif is_object_dtype(self) and isinstance(other, ExtensionArray):
118+
elif is_object_dtype(self.dtype) and isinstance(other, ExtensionArray):
119119
# e.g. PeriodArray
120120
with np.errstate(all="ignore"):
121-
result = op(self.values, other)
121+
result = op(self._values, other)
122122

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

128128
else:
129129
with np.errstate(all="ignore"):
130-
result = op(self.values, np.asarray(other))
130+
result = op(self._values, np.asarray(other))
131131

132132
if is_bool_dtype(result):
133133
return result
@@ -510,7 +510,7 @@ def _shallow_copy(self, values=None, name: Label = no_default):
510510
name = self.name if name is no_default else name
511511
cache = self._cache.copy() if values is None else {}
512512
if values is None:
513-
values = self.values
513+
values = self._values
514514

515515
result = self._simple_new(values, name=name)
516516
result._cache = cache
@@ -722,7 +722,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
722722
indices = ensure_platform_int(indices)
723723
if self._can_hold_na:
724724
taken = self._assert_take_fillable(
725-
self.values,
725+
self._values,
726726
indices,
727727
allow_fill=allow_fill,
728728
fill_value=fill_value,
@@ -734,7 +734,7 @@ def take(self, indices, axis=0, allow_fill=True, fill_value=None, **kwargs):
734734
raise ValueError(
735735
f"Unable to fill values because {cls_name} cannot contain NA"
736736
)
737-
taken = self.values.take(indices)
737+
taken = self._values.take(indices)
738738
return self._shallow_copy(taken)
739739

740740
def _assert_take_fillable(
@@ -1988,7 +1988,7 @@ def is_all_dates(self) -> bool:
19881988
"""
19891989
Whether or not the index values only consist of dates.
19901990
"""
1991-
return is_datetime_array(ensure_object(self.values))
1991+
return is_datetime_array(ensure_object(self._values))
19921992

19931993
# --------------------------------------------------------------------
19941994
# Pickle Methods
@@ -2339,13 +2339,13 @@ def _get_unique_index(self, dropna: bool = False):
23392339
if self.is_unique and not dropna:
23402340
return self
23412341

2342-
values = self.values
2343-
23442342
if not self.is_unique:
23452343
values = self.unique()
23462344
if not isinstance(self, ABCMultiIndex):
23472345
# extract an array to pass to _shallow_copy
23482346
values = values._data
2347+
else:
2348+
values = self._values
23492349

23502350
if dropna:
23512351
try:

0 commit comments

Comments
 (0)