pandas.Series.value_counts
pandas 3.1.1 · Series and accessors · method
Count occurrences of each value or row combination. Set normalize for proportions and dropna=False to keep missing values.
Call syntax
Series.value_counts(normalize=False, sort=True, ascending=False, bins=None, dropna=True)Run the example
Edit the example and select Run Python to see the result.
Parameters
| Parameter | Requirement | Accepted values and behavior |
|---|---|---|
normalize |
Optional Positional or keyword Default False |
bool Use True to return proportions of counted values. |
sort |
Optional Positional or keyword Default True |
bool Use True to order the result by the resulting frequencies. |
ascending |
Optional Positional or keyword Default False |
bool Choose ascending or descending order. Some sorting methods take one flag per sort key. |
bins |
Optional Positional or keyword Default None |
int Group numeric values into interval bins before counting. |
dropna |
Optional Positional or keyword Default True |
bool Set False to count missing values as a separate entry. |
Returns
Series