Author : HASSAN MD TAREQ

Value counts

  • Counts unique values
  • Returns a object containing counts of unique values
  • Syntax: df.SeriesName.value_counts()
  • The first value is the most frequently occurring element. The second, the second most frequently occurring element and so on
  • By default, drop any is true. To set false: .value_counts(..., dropna=False)
import pandas as pd

df = pd.read_csv("olympics.csv", skiprows=4)

df.Edition.value_counts()

df.Gender.value_counts()