(
x, total_length=None, sort=True, ascending=False, normalize=False, **groupby_kwargs
)
| 366 | |
| 367 | |
| 368 | def value_counts_aggregate( |
| 369 | x, total_length=None, sort=True, ascending=False, normalize=False, **groupby_kwargs |
| 370 | ): |
| 371 | out = value_counts_combine(x, **groupby_kwargs) |
| 372 | if normalize: |
| 373 | out /= total_length if total_length is not None else out.sum() |
| 374 | if sort: |
| 375 | if PANDAS_GE_300: |
| 376 | # pandas 3.x ensures that value_counts is stable. |
| 377 | kind = "stable" |
| 378 | else: |
| 379 | kind = "quicksort" |
| 380 | out = out.sort_values(ascending=ascending, kind=kind) |
| 381 | if normalize: |
| 382 | out.name = "proportion" |
| 383 | return out |
| 384 | |
| 385 | |
| 386 | def nbytes(x): |
nothing calls this directly
no test coverage detected