col1 col2 col3
jake male 180
jake male 140
john female 230
john male 100
let say we have this kind of df
if I want to group col1, and col2 and make new dataframe like this
col1 col2 col3
jake male [180,140]<-mean
john female [230]<-mean
john male [100]<-mean
I tryied to use the group by
keyword_mean = df.groupby(['col1','col2'])['col3'].agg(['mean']).reset_index()
but it keep making the duplicated col1 and col2