Seaborn Visualize Groups
How can I plot this data frame using seaborn to show the KPI per model? allFrame = pd.DataFrame({'modelName':['first','second', 'third'], 'kpi_1':[1,2,3]
Solution 1:
Try melt
ing the dataframe first, and then you can plot using seaborn
:
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)
Thanks!
Post a Comment for "Seaborn Visualize Groups"