top_n¶
-
hhpy.ds.top_n(s: Sequence[T_co], n: int, w: Optional[Sequence[T_co]] = None) → list[source]¶ select n elements form a categorical pandas series with the highest counts
Parameters: - s – pandas Series to select from
- n – how many elements to return
- w – weights, if given the weights are summed instead of just counting entries in s [optional]
Returns: List of top n elements