df:
name score A 1 A 2 A 3 A 4 A 5 B 2 B 4 B 6 B 8
Want to get the following new dataframe in
Table is stored in dataframe named df
df
df= pd.read_csv(io.StringIO(data),delimiter='\s+')
Just specify column name and describe give you required output. In this way you calculate w.r.t any column
describe
df.groupby('name')['score'].describe()