pandas how to assign column name when aggregate same column -
following command returns df contains 'website_id' , 'ctr':'var' 2 column. how can return df contains 4 columns appropriate column name?
df.groupby(['website_id']).agg({'ctr':'count','ctr':'mean', 'ctr':'var'}
it easier work sample df , expected output think need
df.groupby(['website_id']).agg(['count','mean', 'var'])
Comments
Post a Comment