valueCounts
Return DataFrame containing counts of unique values in DataFrame or DataColumn.
valueCounts(sort = true, ascending = false, dropNA = false)
     [ { columns } ]
See column selectors for how to select the columns for this operation.
Parameters:
sort: Boolean = true— sort by countascending: Boolean = false— sort in ascending orderdropNA: Boolean = true— don't include counts ofNAvaluescolumns = all— columns to use when counting unique combinations
df.city.valueCounts()
df.valueCounts { name and city }
24 October 2025