Seaborn visualize groups
<p>How can I plot this data frame using seaborn to show the KPI per model?</p>

<pre><code>allFrame = pd.DataFrame({'modelName':['first','second', 'third'],
                           'kpi_1':[1,2,3],
                           'kpi_2':[2,4,3]})
</code></pre>

<p>Not like <code>sns.barplot(x="kpi2", y="kpi1", hue="modelName", data=allFrame)</code>
<a href="http://i.stack.imgur.com/5vH67.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/5vH67.jpg" alt="enter image description here"></a>
But rather like this per KPI
<a href="http://i.stack.imgur.com/er6kQ.jpg" rel="nofollow"><img src="http://i.stack.imgur.com/er6kQ.jpg" alt="enter image description here"></a></p>

<p>Try <code>melt</code>ing the dataframe first, and then you can plot using <code>seaborn</code>:</p>

<pre><code>import pandas as pd
import seaborn as sns

allFrame = pd.DataFrame({'modelName':['first','second', 'third'],
                           'kpi_1':[1,2,3],
                           'kpi_2':[2,4,3]})
allFrame2 = pd.melt(frame=allFrame, 
                          id_vars=['modelName'], 
                          value_vars=["kpi_1","kpi_2"], 
                          value_name="Values", var_name="kpis")

sns.barplot(x="kpis", y="Values", hue="modelName", data=allFrame2)
</code></pre>

<p>Thanks!</p>

python plot group seaborn