Python Forum
Histogram help - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Data Science (https://python-forum.io/forum-44.html)
+--- Thread: Histogram help (/thread-6398.html)



Histogram help - dandatadan - Nov-20-2017



I want to group the categorical variable values (Materials) from an attribute (arr1) and plot against their corresponding numerical totals? (first the totals in 'arr2' & then in 'arr3')

data = pd.read_csv('Luton1516_DD.csv')

numpyArray = data.as_matrix(["Material", "DD_ComingledTonnes","DD_SegregatedTonnes"])

arr1 = numpyArray[:,0]
arr2 = numpyArray[:,1] 
arr3 = numpyArray[:,2]

df1 = pd.DataFrame({'A': arr2,'group': arr1})
df1.pivot(columns='group', values='A').plot.hist(stacked=True)
Can anyone offer help with this?


RE: Histogram help - heiner55 - Nov-25-2017

It is difficult to help, without some lines from Luton.csv