example data:
exdata = {'year':[1 ,2 ,5 ,7 ,2 ,3 ,2 ,4 ,8 ,9],
'price':[120 ,99 ,55 ,23 ,87 ,31 ,149 ,45 ,32 ,55],
'dist':[999 ,3741 ,8893 ,5321 ,1987 ,9299 ,573 ,4732 ,4536 ,4032],
'loca':['a' ,'b' ,'a' ,'c' ,'d' ,'d' ,'a' ,'e' ,'c' ,'a']}
Using a pandas.pivot_table() to represent by 'price'
pd.pivot_table(df, index=['price'], values=['year','dist'], aggfunc=[np.mean])
I want to represent the 'price' axis as a range in the above table. also want to express the number of each range.
In this case, if the option is available in the 'pd.pivot_table()'