You want to count how many times certain values appear in a column in pandas.
To count the frequency of values in a column in pandas you can use the pandas value_counts() method.
Let’s read a dataset to illustrate it.
import pandas as pd url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/Restaurant.csv' df = pd.read_csv(url) df.head()
Now, suppose I want to count how many restaurants gets the Good, Very Good and Excellent rating, I can use the value_counts() method.