bigframes.geopandas.GeoSeries.value_counts#

GeoSeries.value_counts(normalize: bool = False, sort: bool = True, ascending: bool = False, *, dropna: bool = True)#

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_counts sorts 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 NA values by setting dropna=False:

>>> s.value_counts(dropna=False)
3       2
1       1
2       1
4       1
<NA>    1
Name: count, dtype: Int64
Parameters:
  • normalize (bool, default False) – If True then the object returned will contain the relative frequencies of the unique values.

  • sort (bool, default True) – Sort by frequencies.

  • ascending (bool, default False) – Sort in ascending order.

  • dropna (bool, default True) – Don’t include counts of NaN.

Returns:

Series containing counts of unique values.

Return type:

bigframes.pandas.Series