From 8f9608da0b892495c0d796f3848a5b83e5ad39f8 Mon Sep 17 00:00:00 2001 From: Karthik Velayutham Date: Wed, 22 Feb 2023 10:39:05 -0600 Subject: [PATCH] FEAT: Remove API layer default for groupby.get_group() (#70) [should upstream] --- modin/core/execution/client/query_compiler.py | 1 + modin/pandas/groupby.py | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/modin/core/execution/client/query_compiler.py b/modin/core/execution/client/query_compiler.py index 0f4ff0ae088..8c3a5206a94 100644 --- a/modin/core/execution/client/query_compiler.py +++ b/modin/core/execution/client/query_compiler.py @@ -949,6 +949,7 @@ def forwarding_method(self, by, *args, **kwargs): "tail", "nth", "ngroup", + "get_group", "std", "sem", "rank", diff --git a/modin/pandas/groupby.py b/modin/pandas/groupby.py index 94f7aa82043..70c7a8ec26e 100644 --- a/modin/pandas/groupby.py +++ b/modin/pandas/groupby.py @@ -672,7 +672,13 @@ def var(self, ddof=1): ) def get_group(self, name, obj=None): - return self._default_to_pandas(lambda df: df.get_group(name, obj=obj)) + return self._check_index( + self._wrap_aggregation( + qc_method=type(self._query_compiler).groupby_get_group, + numeric_only=False, + agg_kwargs=dict(name=name, obj=obj), + ) + ) def __len__(self): return len(self.indices) @@ -1333,6 +1339,7 @@ def nsmallest(self, n=5, keep="first"): ) ) + if IsExperimental.get(): from modin.experimental.cloud.meta_magic import make_wrapped_class