bigframes.pandas.Series.value_counts#
- Series.value_counts(normalize: bool = False, sort: bool = True, ascending: bool = False, *, dropna: bool = True)[source]#
Return a Series containing counts of unique values.
The resulting object will be in descending order so that the first element is the most frequently-occurring element. Excludes NA values by default.
Examples:
>>> s = bpd.Series([3, 1, 2, 3, 4, pd.NA], dtype="Int64")
>>> s 0 3 1 1 2 2 3 3 4 4 5 <NA> dtype: Int64
value_countssorts the result by counts in a descending order by default:>>> s.value_counts() 3 2 1 1 2 1 4 1 Name: count, dtype: Int64
You can normalize the counts to return relative frequencies by setting
normalize=True:>>> s.value_counts(normalize=True) 3 0.4 1 0.2 2 0.2 4 0.2 Name: proportion, dtype: Float64
You can get the values in the ascending order of the counts by setting
ascending=True:>>> s.value_counts(ascending=True) 1 1 2 1 4 1 3 2 Name: count, dtype: Int64
You can include the counts of the
NAvalues by settingdropna=False:>>> s.value_counts(dropna=False) 3 2 1 1 2 1 4 1 <NA> 1 Name: count, dtype: Int64
- Parameters:
- Returns:
Series containing counts of unique values.
- Return type: