NVIDIA / NVIDIA/cudf

[BUG] Output of ``GroupBy.apply`` is missing the grouping index

Open
#14,977 4 comments 0 reactions 0 assignees View on GitHub
bug Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

**Describe the bug**
There seems to be a subtle difference between cudf and pandas for `groupby(...).apply(...)`

**Steps/Code to reproduce bug**
```python
import cudf

df = cudf.DataFrame({"a": ["cat", "dog", "cat"], "b": [0, 1, 0]})
df.groupby(["a", "b"]).apply(lambda x: x)
```
```
a b
0 cat 0
2 cat 0
1 dog 1
```
**Pandas Result**:
```
a b
a b
cat 0 0 cat 0
2 cat 0
dog 1 1 dog 1
```

**Expected behavior**
I would expect the behavior of cudf and pandas to be consistent.

**Additional context**
I found this issue while debugging TPC-h query 16 and 21 with dask-cudf + dask-expr.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.