Skip to content

Commit 5ed054c

Browse files
committed
Use series in whatsnew example
1 parent 9e29a11 commit 5ed054c

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
@@ -233,16 +233,17 @@ These are bug fixes that might have notable behavior changes.
233233
``Categorical.unique`` now always maintains same dtype as original
234234
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
235235

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

240240
As an example of this, given:
241241

242242
.. ipython:: python
243243
244244
dtype = pd.CategoricalDtype(['bad', 'neutral', 'good'], ordered=True)
245-
original = pd.Categorical(['good', 'good', 'bad', 'bad'], dtype=dtype)
245+
cat = pd.Categorical(['good', 'good', 'bad', 'bad'], dtype=dtype)
246+
original = pd.Series(cat)
246247
unique = original.unique()
247248
248249
*pandas < 1.2.0*:

0 commit comments

Comments
 (0)