From ae30a27b8e849103ce59747487edc959d2718bf9 Mon Sep 17 00:00:00 2001 From: Keith Kraus Date: Wed, 1 Mar 2023 16:31:40 -0500 Subject: [PATCH 1/2] Update docs for groupby based on the discussion in https://github.com/data-apis/dataframe-api/issues/102 --- .../dataframe_api/dataframe_object.py | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 9b3e0857..203ab5e9 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -11,9 +11,27 @@ class DataFrame: - def groupby(self, keys: list[str], /) -> GroupBy: + def groupby(self, keys: Sequence[str], /) -> GroupBy: """ Group the DataFrame by the given columns. + + Parameters + ---------- + keys : Sequence[str] + + Returns + ------- + GroupBy + + Raises + ------ + KeyError + If any of the requested keys are not present. + + Notes + ----- + The order of the keys and the order of rows within each group is not + guaranteed and is implementation defined. """ ... From 5d1c5a224ac7eabee9eaa83784030aefe39af169 Mon Sep 17 00:00:00 2001 From: Keith Kraus Date: Wed, 1 Mar 2023 19:38:50 -0500 Subject: [PATCH 2/2] try rewording --- spec/API_specification/dataframe_api/dataframe_object.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/spec/API_specification/dataframe_api/dataframe_object.py b/spec/API_specification/dataframe_api/dataframe_object.py index 203ab5e9..7de9d006 100644 --- a/spec/API_specification/dataframe_api/dataframe_object.py +++ b/spec/API_specification/dataframe_api/dataframe_object.py @@ -30,8 +30,9 @@ def groupby(self, keys: Sequence[str], /) -> GroupBy: Notes ----- - The order of the keys and the order of rows within each group is not - guaranteed and is implementation defined. + Downstream operations from this function, like aggregations, return + results for which row order is not guaranteed and is implementation + defined. """ ...