From e1faa00fb6cb41bf31f769c2d7996c05ace0cc95 Mon Sep 17 00:00:00 2001 From: gabuzi <15203081+gabuzi@users.noreply.github.com> Date: Tue, 27 Feb 2024 17:55:42 +0000 Subject: [PATCH 1/2] Add clarification to groupby docs regarding hashes and equality --- pandas/core/shared_docs.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index 787a03471cf6e..caba244e57e65 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -174,6 +174,12 @@ Notes ----- +The implementation of groupby is hash-based, meaning in particular that +objects that compare as equal will be considered to be in the same group. +An exception to this is that pandas has special handling of NA values: +any NA values will be collapsed to a single group, regardless of how +they compare. See the user guide linked below for more details. + See the `user guide `__ for more detailed usage and examples, including splitting an object into groups, From 8d1b2998cc9fbc7314aba794e88b5712b5fd070f Mon Sep 17 00:00:00 2001 From: gabuzi <15203081+gabuzi@users.noreply.github.com> Date: Wed, 6 Mar 2024 20:47:16 +0000 Subject: [PATCH 2/2] shared_docs.py: Move hash-based note below user guide link --- pandas/core/shared_docs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pandas/core/shared_docs.py b/pandas/core/shared_docs.py index caba244e57e65..06621f7127da3 100644 --- a/pandas/core/shared_docs.py +++ b/pandas/core/shared_docs.py @@ -174,16 +174,16 @@ Notes ----- -The implementation of groupby is hash-based, meaning in particular that -objects that compare as equal will be considered to be in the same group. -An exception to this is that pandas has special handling of NA values: -any NA values will be collapsed to a single group, regardless of how -they compare. See the user guide linked below for more details. - See the `user guide `__ for more detailed usage and examples, including splitting an object into groups, iterating through groups, selecting a group, aggregation, and more. + +The implementation of groupby is hash-based, meaning in particular that +objects that compare as equal will be considered to be in the same group. +An exception to this is that pandas has special handling of NA values: +any NA values will be collapsed to a single group, regardless of how +they compare. See the user guide linked above for more details. """ _shared_docs["melt"] = """