DataFrame.value_counts(subset=None, normalize=False, sort=True, ascending=False, dropna=True)#

Return a Series containing counts of unique rows in the DataFrame.

subset: list-like, optional

Columns to use when counting unique combinations.

normalize: bool, default False

Return proportions rather than frequencies.

sort: bool, default True

Sort by frequencies.

ascending: bool, default False

Sort in ascending order.

dropna: bool, default True

Don’t include counts of rows that contain NA values.



The returned Series will have a MultiIndex with one level per input column. By default, rows that contain any NA values are omitted from the result. By default, the resulting Series will be in descending order so that the first element is the most frequently-occurring row.


>>> import cudf
>>> df = cudf.DataFrame({'num_legs': [2, 4, 4, 6],
...                    'num_wings': [2, 0, 0, 0]},
...                    index=['falcon', 'dog', 'cat', 'ant'])
>>> df.value_counts()
num_legs  num_wings
4         0            2
2         2            1
6         0            1
dtype: int64