Skip to content

Commit 5b1c172

Browse files
committed
Add get_values override to CategoricalIndex, and remove previous workaround
1 parent 248b9ae commit 5b1c172

File tree

4 files changed

+8
-19
lines changed

4 files changed

+8
-19
lines changed

doc/source/whatsnew/v0.16.2.txt

+3-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@ Bug Fixes
6666
- Bug in getting timezone data with ``dateutil`` on various platforms ( :issue:`9059`, :issue:`8639`, :issue:`9663`, :issue:`10121`)
6767
- Bug in display datetimes with mixed frequencies uniformly; display 'ms' datetimes to the proper precision. (:issue:`10170`)
6868

69-
- Bung in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
69+
- Bun in ``Series`` arithmetic methods may incorrectly hold names (:issue:`10068`)
70+
71+
- Bug in ``GroupBy.get_group`` when grouping on multiple keys, one of which is categorical. (:issue:`10132`)
7072

7173
- Bug in ``DatetimeIndex`` and ``TimedeltaIndex`` names are lost after timedelta arithmetics ( :issue:`9926`)
7274

doc/source/whatsnew/v0.17.0.txt

-10
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,3 @@ Performance Improvements
5757

5858
Bug Fixes
5959
~~~~~~~~~
60-
61-
- Bug in ``Categorical`` repr with ``display.width`` of ``None`` in Python 3 (:issue:`10087`)
62-
63-
64-
- Bug in ``Timestamp``'s' ``microsecond``, ``quarter``, ``dayofyear``, ``week`` and ``daysinmonth`` properties return ``np.int`` type, not built-in ``int``. (:issue:`10050`)
65-
- Bug in ``GroupBy.get_group`` when grouping on multiple keys, one of which is categorical. (:issue:`10132`)
66-
- Bug in ``NaT`` raises ``AttributeError`` when accessing to ``daysinmonth``, ``dayofweek`` properties. (:issue:`10096`)
67-
68-
69-

pandas/core/groupby.py

+1-8
Original file line numberDiff line numberDiff line change
@@ -1301,18 +1301,11 @@ def apply(self, f, data, axis=0):
13011301
@cache_readonly
13021302
def indices(self):
13031303
""" dict {group name -> group indices} """
1304-
1305-
def extract_values(x):
1306-
if isinstance(x, CategoricalIndex):
1307-
return x.values.get_values()
1308-
else:
1309-
return _values_from_object(x)
1310-
13111304
if len(self.groupings) == 1:
13121305
return self.groupings[0].indices
13131306
else:
13141307
label_list = [ping.labels for ping in self.groupings]
1315-
keys = [extract_values(ping.group_index) for ping in self.groupings]
1308+
keys = [_values_from_object(ping.group_index) for ping in self.groupings]
13161309
return _get_indices_dict(label_list, keys)
13171310

13181311
@property

pandas/core/index.py

+4
Original file line numberDiff line numberDiff line change
@@ -2964,6 +2964,10 @@ def values(self):
29642964
""" return the underlying data, which is a Categorical """
29652965
return self._data
29662966

2967+
def get_values(self):
2968+
""" return the underlying data as an ndarray """
2969+
return self._data.get_values()
2970+
29672971
@property
29682972
def codes(self):
29692973
return self._data.codes

0 commit comments

Comments
 (0)