Skip to content

Commit 032e139

Browse files
committed
Use series in whatsnew example
1 parent 2152fe7 commit 032e139

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

doc/source/whatsnew/v1.3.0.rst

+4-3
Original file line numberDiff line numberDiff line change
@@ -208,16 +208,17 @@ These are bug fixes that might have notable behavior changes.
208208
``Categorical.unique`` now always maintains same dtype as original
209209
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
210210

211-
Previously, when calling :meth:`Categorical.unique`, unused categories in the new array
211+
Previously, when calling :meth:`~Categorical.unique` with categorical data, unused categories in the new array
212212
would be removed, meaning that the dtype of the new array would be different than the
213-
original, if some categories are not present in the unique array:
213+
original, if some categories are not present in the unique array (:issue:`18291`)
214214

215215
As an example of this, given:
216216

217217
.. ipython:: python
218218
219219
dtype = pd.CategoricalDtype(['bad', 'neutral', 'good'], ordered=True)
220-
original = pd.Categorical(['good', 'good', 'bad', 'bad'], dtype=dtype)
220+
cat = pd.Categorical(['good', 'good', 'bad', 'bad'], dtype=dtype)
221+
original = pd.Series(cat)
221222
unique = original.unique()
222223
223224
*pandas < 1.2.0*:

0 commit comments

Comments
 (0)