I have a data set with three colums: rating , breed, and dog.
import pandas as pd
dogs = {\'breed\': [\'Chihuahua\', \'Chihuahua\', \'Dalmatian\', \'Sphynx\'
Once you groupby and select a column, your dog
column doesn't exist anymore in the context you have selected (and even if it did you are not accessing it correctly).
Filter your dataframe first, then use groupby
with mean
df[df.dog].groupby('breed')['rating'].mean().reset_index()
breed rating
0 Chihuahua 8.5
1 Dalmatian 10.0