From 5a77eba768cd05a43ab3a2d194b8656108160e07 Mon Sep 17 00:00:00 2001 From: aamnv Date: Mon, 13 Jun 2022 20:29:17 +0000 Subject: [PATCH] DOC: GH5456 Adding workaround info on NA / NaT handling for groupby --- doc/source/user_guide/groupby.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/doc/source/user_guide/groupby.rst b/doc/source/user_guide/groupby.rst index ba3fb17cc8764..a95d1ec89063d 100644 --- a/doc/source/user_guide/groupby.rst +++ b/doc/source/user_guide/groupby.rst @@ -1268,6 +1268,11 @@ automatically excluded. In other words, there will never be an "NA group" or generally discarding the NA group anyway (and supporting it was an implementation headache). +.. note:: + If you need to include NaN or NaT values in your grouping, you can workaround the automatic exclusion by replacing + the NaN / NaT values with a placeholder string. For example, you can use ``df.fillna("default", inplace=True)`` to + create a **default** group in your dataframe that captures NaN / NaT values. + Grouping with ordered factors ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~