Reputation: 727
Following command returns a df contains only 'website_id' and 'ctr':'var' 2 column. How can I return df contains all 4 columns with appropriate column name?
df.groupby(['website_id']).agg({'ctr':'count','ctr':'mean', 'ctr':'var'}
Upvotes: 1
Views: 190
Reputation: 38415
It would be easier to work with a sample df and expected output but I think you need
df.groupby(['website_id']).agg(['count','mean', 'var'])
Upvotes: 2