Skip to content

Commit

Permalink
Improve
Browse files Browse the repository at this point in the history
  • Loading branch information
phofl committed Aug 16, 2024
1 parent 5d7b71e commit bcc1c8d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dask_expr/_collection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4237,7 +4237,7 @@ def value_counts(
if isinstance(self.dtype, CategoricalDtype):
# unobserved or huge categories will lead to oom errors
if self.cat.known:
split_out = max(len(self.dtype.categories) // 100_000, 1)
split_out = 1 + len(self.dtype.categories) // 100_000
else:
split_out = True
else:
Expand Down
2 changes: 1 addition & 1 deletion dask_expr/tests/test_reductions.py
Original file line number Diff line number Diff line change
Expand Up @@ -550,5 +550,5 @@ def test_cat_value_counts_large_unknown_categories():

df = from_pandas(pdf, npartitions=50)
result = df.x.value_counts()
assert result.npartitions == 2 # known but large
assert result.npartitions == 3 # known but large
assert_eq(result, expected, check_index=False, check_dtype=False)

0 comments on commit bcc1c8d

Please sign in to comment.