Skip to content

Commit 30e0540

Browse files
committed
PR feedback: issue reference and whatsnew
1 parent 2ff69a3 commit 30e0540

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

doc/source/whatsnew/v1.4.0.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ Other enhancements
211211
- :meth:`.GroupBy.mean` now supports `Numba <http://numba.pydata.org/>`_ execution with the ``engine`` keyword (:issue:`43731`)
212212
- :meth:`Timestamp.isoformat`, now handles the ``timespec`` argument from the base :class:``datetime`` class (:issue:`26131`)
213213
- :meth:`NaT.to_numpy` ``dtype`` argument is now respected, so ``np.timedelta64`` can be returned (:issue:`44460`)
214-
-
214+
- :meth:`Categorical.value_counts` now supports the argument ``observed`` (:issue:`43498`)
215215

216216
.. ---------------------------------------------------------------------------
217217

pandas/tests/extension/test_categorical.py

+2
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def test_value_counts(self, all_data, dropna):
164164
return super().test_value_counts(all_data, dropna)
165165

166166
def test_value_counts_observed(self, data):
167+
# GH 43498
168+
# When observed=True is passed, unobserved categories should be omitted
167169
data = data.add_categories(["#", "?"]) # Add some unobserved categories
168170
series = pd.Series(data, dtype=data.categories.dtype)
169171
result = data.value_counts(observed=True).sort_index()

0 commit comments

Comments
 (0)