Skip to content

Commit

Permalink
Add client support for SeriesGroupby unique, nsmallest, nlargest (mod…
Browse files Browse the repository at this point in the history
…in-project#63) [core]

* Add client support for SeriesGroupby unique, nsmallest, nlargest

Signed-off-by: Naren Krishna <naren@ponder.io>

---------

Signed-off-by: Naren Krishna <naren@ponder.io>
  • Loading branch information
naren-ponder authored and vnlitvinov committed Mar 16, 2023
1 parent 7aad414 commit 41da235
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions modin/pandas/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -1434,6 +1434,32 @@ def _iter(self):
for k in (sorted(group_ids) if self._sort else group_ids)
)

def unique(self):
return self._check_index(
self._wrap_aggregation(
type(self._query_compiler).groupby_unique,
numeric_only=False,
)
)

def nlargest(self, n=5, keep="first"):
return self._check_index(
self._wrap_aggregation(
type(self._query_compiler).groupby_nlargest,
agg_kwargs=dict(n=n, keep=keep),
numeric_only=True,
)
)

def nsmallest(self, n=5, keep="first"):
return self._check_index(
self._wrap_aggregation(
type(self._query_compiler).groupby_nsmallest,
agg_kwargs=dict(n=n, keep=keep),
numeric_only=True,
)
)

def value_counts(
self,
normalize: bool = False,
Expand Down

0 comments on commit 41da235

Please sign in to comment.