Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions pandas/_libs/groupby.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -986,8 +986,8 @@ def group_last(rank_t[:, :] out,
def group_nth(rank_t[:, :] out,
int64_t[:] counts,
ndarray[rank_t, ndim=2] values,
const int64_t[:] labels, int64_t rank=1,
Py_ssize_t min_count=-1):
const int64_t[:] labels, int64_t rank=1
):
"""
Only aggregates on axis=0
"""
Expand All @@ -998,8 +998,6 @@ def group_nth(rank_t[:, :] out,
ndarray[int64_t, ndim=2] nobs
bint runtime_error = False

assert min_count == -1, "'min_count' only used in add and prod"

# TODO(cython 3.0):
# Instead of `labels.shape[0]` use `len(labels)`
if not len(values) == labels.shape[0]:
Expand Down
3 changes: 1 addition & 2 deletions pandas/core/groupby/ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,7 @@ def _aggregate(
):
if agg_func is libgroupby.group_nth:
# different signature from the others
# TODO: should we be using min_count instead of hard-coding it?
agg_func(result, counts, values, comp_ids, rank=1, min_count=-1)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

one alternative here is to remove the keyword from the libgroupby function.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I went with that

Actually we don't use the min_count argument in the libgroupby function - I guess that it was put there to homogenize signatures, but now they're different anyways

agg_func(result, counts, values, comp_ids, rank=1)
else:
agg_func(result, counts, values, comp_ids, min_count)

Expand Down