At this moment I have pandas Dataframe called mergeDf
(40 rows x 2 columns) with column types float and categorical - see below.
NH01 float64
NH01cat category
dtype: object
I am trying to built a side by side boxplot in seaborn that will have all values from column NH01 on the y-axis and they should be categorized based on their value in NH01cat
column.My final data frame will consist of 42 columns where each two adjacent columns will be quantitative and categorical data as shown in the example (e.g. NH01 - float,NH01- categorical,NH02 -float, NH02cat- categorical and so on.).The final plot should consist of 21 pairs of boxplots based on each dataset of 2 neighboring columns)
NH01 NH01cat
0 0.428581 NacZ
1 0.425339 NacZ
2 0.428772 NacZ
3 0.425148 NacZ
4 0.428581 NacZ
5 0.433540 NacZ
6 0.422096 NacX
7 0.423431 NacX
8 0.432205 NacX
9 0.431824 NacX
10 0.424194 NacX`
I am trying the below line of code:
ax=sns.boxplot(y=mergeDf['NH01'], hue="NH01cat",orient='v', data=mergeDf, linewidth=2.5)
but the result I am getting is a single boxplot.
How could I group the boxplot based on the available data?
Thanks