[FEA] Support the `min_count` argument in groupby aggregations
- Dominant language
- C++
- Stars
- 9.8k
- Forks
- 1.1k
- Avg merge
- 3d 6m
- Merged PRs (30d)
- 278
Description
Updated 5/13/2024: `numeric_only` is now supported (as of #10629). `min_count` is not yet supported.
In Pandas, groupby aggregations (e.g., [`max`](https://pandas.pydata.org/docs/reference/api/pandas.core.groupby.GroupBy.max.html)) accept the following arguments:
- `min_count`: the minimum number of non-null values required per group in order for the result to be non-null
- `numeric_only`: only aggregate numeric columns
It would be nice for cuDF to support these as well:
```python
In [6]: df = cudf.DataFrame({'a': [1, 1, 1, 2, 2], 'b': ['a', 'b', 'c', 'd', 'e'], 'c': [1, 2, 3, 4, 5]})
In [7]: df
Out[7]:
a b c
0 1 a 1
1 1 b 2
2 1 c 3
3 2 d 4
4 2 e 5
In [8]: df.groupby('a').max(numeric_only=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
in
----> 1 df.groupby('a').max(numeric_only=True)
TypeError: max() got an unexpected keyword argument 'numeric_only'
In [9]: df.to_pandas().groupby('a').max(numeric_only=True)
Out[9]:
c
a
1 3
2 5
```
Contributor guide
Assessment
This issue has not been assessed yet.