You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/source/groupby.rst
+2-2
Original file line number
Diff line number
Diff line change
@@ -1060,7 +1060,7 @@ To select from a DataFrame or Series the nth item, use the nth method. This is a
1060
1060
g.nth(-1)
1061
1061
g.nth(1)
1062
1062
1063
-
If you want to select the nth not-null item, use the ``dropna`` kwarg. For a DataFrame this should be either ``'any'`` or ``'all'`` just like you would pass to dropna, for a Series this just needs to be truthy.
1063
+
If you want to select the nth not-null item, use the ``dropna`` kwarg. For a DataFrame this should be either ``'any'`` or ``'all'`` just like you would pass to dropna:
1064
1064
1065
1065
.. ipython:: python
1066
1066
@@ -1072,7 +1072,7 @@ If you want to select the nth not-null item, use the ``dropna`` kwarg. For a Dat
1072
1072
g.nth(-1, dropna='any') # NaNs denote group exhausted when using dropna
1073
1073
g.last()
1074
1074
1075
-
g.B.nth(0, dropna=True)
1075
+
g.B.nth(0, dropna='all')
1076
1076
1077
1077
As with other methods, passing ``as_index=False``, will achieve a filtration, which returns the grouped row.
Copy file name to clipboardExpand all lines: doc/source/whatsnew/v0.21.0.txt
+29
Original file line number
Diff line number
Diff line change
@@ -10,6 +10,8 @@ users upgrade to this version.
10
10
Highlights include:
11
11
12
12
- Integration with `Apache Parquet <https://parquet.apache.org/>`__, including a new top-level :func:`read_parquet` and :func:`DataFrame.to_parquet` method, see :ref:`here <io.parquet>`.
13
+
- New user-facing :class:`pandas.api.types.CategoricalDtype` for specifying
14
+
categoricals independent of the data, see :ref:`here <whatsnew_0210.enhancements.categorical_dtype>`.
13
15
14
16
Check the :ref:`API Changes <whatsnew_0210.api_breaking>` and :ref:`deprecations <whatsnew_0210.deprecations>` before updating.
15
17
@@ -89,6 +91,31 @@ This does not raise any obvious exceptions, but also does not create a new colum
89
91
90
92
Setting a list-like data structure into a new attribute now raise a ``UserWarning`` about the potential for unexpected behavior. See :ref:`Attribute Access <indexing.attribute_access>`.
91
93
94
+
.. _whatsnew_0210.enhancements.categorical_dtype:
95
+
96
+
``CategoricalDtype`` for specifying categoricals
97
+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
98
+
99
+
:class:`pandas.api.types.CategoricalDtype` has been added to the public API and
100
+
expanded to include the ``categories`` and ``ordered`` attributes. A
101
+
``CategoricalDtype`` can be used to specify the set of categories and
102
+
orderedness of an array, independent of the data themselves. This can be useful,
103
+
e.g., when converting string data to a ``Categorical`` (:issue:`14711`,
The ``.dtype`` property of a ``Categorical``, ``CategoricalIndex`` or a
115
+
``Series`` with categorical type will now return an instance of ``CategoricalDtype``.
116
+
117
+
See the :ref:`CategoricalDtype docs <categorical.categoricaldtype>` for more.
118
+
92
119
.. _whatsnew_0210.enhancements.other:
93
120
94
121
Other Enhancements
@@ -498,6 +525,7 @@ Conversion
498
525
- Bug in :func:`Series.fillna` returns frame when ``inplace=True`` and ``value`` is dict (:issue:`16156`)
499
526
- Bug in :attr:`Timestamp.weekday_name` returning a UTC-based weekday name when localized to a timezone (:issue:`17354`)
500
527
- Bug in ``Timestamp.replace`` when replacing ``tzinfo`` around DST changes (:issue:`15683`)
528
+
- Bug in ``Timedelta`` construction and arithmetic that would not propagate the ``Overflow`` exception (:issue:`17367`)
501
529
502
530
Indexing
503
531
^^^^^^^^
@@ -517,6 +545,7 @@ Indexing
517
545
- Bug in ``CategoricalIndex`` reindexing in which specified indices containing duplicates were not being respected (:issue:`17323`)
518
546
- Bug in intersection of ``RangeIndex`` with negative step (:issue:`17296`)
519
547
- Bug in ``IntervalIndex`` where performing a scalar lookup fails for included right endpoints of non-overlapping monotonic decreasing indexes (:issue:`16417`, :issue:`17271`)
548
+
- Bug in :meth:`DataFrame.first_valid_index` and :meth:`DataFrame.last_valid_index` when no valid entry (:issue:`17400`)
520
549
- Bug in ``Series.rename`` when called with `str` alters name of series rather than index of series. (:issue:`17407`)
0 commit comments