You want to calculate the average or mean of a column in pandas.
Read a dataset to work with.
import pandas as pd url = 'https://raw.githubusercontent.com/bprasad26/lwd/master/data/Restaurant.csv' df = pd.read_csv(url) df.head()
Now if I want to calculate the average or mean of the Meal Price column, I will simply select the this column and call .mean() on it.
df['Meal Price ($)'].mean()
output - 25.89666666666667