1
我有一个数据集格式化为熊猫数据框。请参阅seaborn http://seaborn.pydata.org/generated/seaborn.factorplot.html#seaborn.factorplot如何获得pandas.dataframe中每个组的平均值,如seaborn.factorplot
>>> import seaborn as sns
>>> sns.set(style="ticks")
>>> exercise = sns.load_dataset("exercise")
>>> g = sns.factorplot(x="time", y="pulse", hue="kind", data=exercise)
随着sns.factorplot本例中,我可以看到数据的按组的平均值(此实例中,图表显示了脉冲的在30年1月15日分钟组由平均“种”)。
我想直接得到图表中的“值”。 例如
time kind mean standard deviation
1 min running xx xx
15 min running xx xx
我可以使用2 - 深度循环来得到我想要的价值,但我认为应该有一些easyier在大熊猫,因为它是一个共同的要求。
与matplotlib不同,它会返回图中的所有值,seaborn会返回一个Facetgrid对象。 Facetgrid似乎没有我想要的数据。
呀,这其实我想要的。非常感谢你。 – Zealseeker