I have a column in pandas dataframe:
df.['A']:
1
1
1
2
2
3
1
2
3
1
2
3
I need to plot a histogram which will show how much if 1, of 2 and of 3 i have. For that i firstly count the amount of all 1, 2, and 3:
print df.groupby(df.index)['A'].nunique()
but instead of getting
1 5
2 4
3 3
i get
1
1
1
what is my mistake? and may be there is a better way of plotting it withpout previous extraction of counted data?
IIUC you can just call df['A'].hist()
:
This will automatically plot the frequency of the unique values
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With