From b10f692994ebf1b9f5c681f1b5ccc20a28561332 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sat, 9 Nov 2024 00:35:16 +0530 Subject: [PATCH 1/3] DOC: fix SA01,ES01 for pandas.core.groupby.DataFrameGroupBy.groups --- ci/code_checks.sh | 1 - pandas/core/groupby/groupby.py | 12 ++++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index adcf48507698b..d3211a8456ce1 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -96,7 +96,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.arrays.TimedeltaArray PR07,SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.boxplot PR07,RT03,SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.get_group RT03,SA01" \ - -i "pandas.core.groupby.DataFrameGroupBy.groups SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.indices SA01" \ -i "pandas.core.groupby.DataFrameGroupBy.nth PR02" \ -i "pandas.core.groupby.DataFrameGroupBy.nunique SA01" \ diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 8f2e5d2ee09d4..a64c7879a365b 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -435,6 +435,18 @@ def groups(self) -> dict[Hashable, Index]: """ Dict {group name -> group labels}. + This property provides a dictionary representation of the groupings formed + during a groupby operation, where each key represents a unique group value from + the specified column(s), and each value is a list of index of the row labels + that belong to that group. + + See Also + -------- + core.groupby.DataFrameGroupBy.get_group : Get a DataFrame or Series that + contains the rows belonging to the specified group. + core.groupby.DataFrameGroupBy.indices : Get a dict with group labels as keys + and lists of integer indices of rows in each group as values. + Examples -------- From 38bfe3b7fe003a09816c53677a00ea0869bcede3 Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sun, 10 Nov 2024 22:10:01 +0530 Subject: [PATCH 2/3] Update pandas/core/groupby/groupby.py Co-authored-by: Richard Shadrach <45562402+rhshadrach@users.noreply.github.com> --- pandas/core/groupby/groupby.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index a64c7879a365b..5a77d5c3c797f 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -437,7 +437,7 @@ def groups(self) -> dict[Hashable, Index]: This property provides a dictionary representation of the groupings formed during a groupby operation, where each key represents a unique group value from - the specified column(s), and each value is a list of index of the row labels + the specified column(s), and each value is a list of index labels that belong to that group. See Also From 9890c705a2032ae337ac0574ec0bbd699ef2d0ef Mon Sep 17 00:00:00 2001 From: Tuhin Sharma Date: Sun, 10 Nov 2024 23:42:47 +0530 Subject: [PATCH 3/3] DOC: fix SA01,ES01 for pandas.core.groupby.DataFrameGroupBy.groups --- ci/code_checks.sh | 2 -- pandas/core/groupby/groupby.py | 10 ++++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 459292ab7a21f..cdc73266a4891 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -100,7 +100,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.core.groupby.DataFrameGroupBy.plot PR02" \ -i "pandas.core.groupby.DataFrameGroupBy.sem SA01" \ -i "pandas.core.groupby.SeriesGroupBy.get_group RT03,SA01" \ - -i "pandas.core.groupby.SeriesGroupBy.groups SA01" \ -i "pandas.core.groupby.SeriesGroupBy.indices SA01" \ -i "pandas.core.groupby.SeriesGroupBy.is_monotonic_decreasing SA01" \ -i "pandas.core.groupby.SeriesGroupBy.is_monotonic_increasing SA01" \ @@ -108,7 +107,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then -i "pandas.core.groupby.SeriesGroupBy.plot PR02" \ -i "pandas.core.groupby.SeriesGroupBy.sem SA01" \ -i "pandas.core.resample.Resampler.get_group RT03,SA01" \ - -i "pandas.core.resample.Resampler.groups SA01" \ -i "pandas.core.resample.Resampler.indices SA01" \ -i "pandas.core.resample.Resampler.max PR01,RT03,SA01" \ -i "pandas.core.resample.Resampler.mean SA01" \ diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 5a77d5c3c797f..9c30132347111 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -442,10 +442,12 @@ def groups(self) -> dict[Hashable, Index]: See Also -------- - core.groupby.DataFrameGroupBy.get_group : Get a DataFrame or Series that - contains the rows belonging to the specified group. - core.groupby.DataFrameGroupBy.indices : Get a dict with group labels as keys - and lists of integer indices of rows in each group as values. + core.groupby.DataFrameGroupBy.get_group : Retrieve group from a + ``DataFrameGroupBy`` object with provided name. + core.groupby.SeriesGroupBy.get_group : Retrieve group from a + ``SeriesGroupBy`` object with provided name. + core.resample.Resampler.get_group : Retrieve group from a + ``Resampler`` object with provided name. Examples --------