We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 1fe1bc2 commit 44805dbCopy full SHA for 44805db
pandas/core/groupby.py
@@ -4369,8 +4369,8 @@ def _get_group_index_sorter(group_index, ngroups):
4369
count = len(group_index)
4370
alpha = 0.0 # taking complexities literally; there may be
4371
beta = 1.0 # some room for fine-tuning these parameters
4372
- with np.errstate(divide='ignore', invalid='ignore'):
4373
- do_groupsort = alpha + beta * ngroups < count * np.log(count)
+ do_groupsort = (count > 0 and ((alpha + beta * ngroups) <
+ (count * np.log(count))))
4374
if do_groupsort:
4375
sorter, _ = _algos.groupsort_indexer(_ensure_int64(group_index),
4376
ngroups)
0 commit comments