Skip to content

Commit 44805db

Browse files
committed
ENH: Rearrange expression to avoid generating a warning that would need to be silenced.
1 parent 1fe1bc2 commit 44805db

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/groupby.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -4369,8 +4369,8 @@ def _get_group_index_sorter(group_index, ngroups):
43694369
count = len(group_index)
43704370
alpha = 0.0 # taking complexities literally; there may be
43714371
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)
4372+
do_groupsort = (count > 0 and ((alpha + beta * ngroups) <
4373+
(count * np.log(count))))
43744374
if do_groupsort:
43754375
sorter, _ = _algos.groupsort_indexer(_ensure_int64(group_index),
43764376
ngroups)

0 commit comments

Comments
 (0)