Pandas: Boxplot Of One Column Based On Another Column
Say I have a dataframe like the following: my_dataframe:     Age  Group 0  31   A 1  24   A 2  25   A 3  36   A 4  50   NaN 5  27   A 6  49   A 7  24   A 8  63   A 9  25   A 10  65
Solution 1:
Misread 1st time so gave answer for histograms... keeking that below. for boxplot the code is:
bp = df.boxplot(by='Group')

suptitle('Bla Bla')
to change or get rid of the automatically generated top Title.
Might be a more elegant way but the following works for histograms:
df[df.Group =='A'].Age.hist()
df[df.Group =='B'].Age.hist()
df[df.Group =='C'].Age.hist()
http://pandas.pydata.org/pandas-docs/dev/visualization.html has some fancy syntax to do this as well. But since only have 3 groups the simple solution is probably sufficient.
Post a Comment for "Pandas: Boxplot Of One Column Based On Another Column"