gpt4 book ai didi

python - 在 df.plot(kind ='hist') 中指定 bean 的数量

转载 作者:太空宇宙 更新时间:2023-11-04 04:57:04 25 4
gpt4 key购买 nike

我有一个数据框df

我想将分组变量的直方图绘制为

df.groupby(['Variable1', 'Variable2']).plot(kind='hist')

有没有办法指定 bin 的数量?

最佳答案

DataFrameGroupBy.hist中使用参数bins :

df.groupby(['Variable1', 'Variable2']).plot.hist(bins=3)

bins : integer, default 10

Number of histogram bins to be used

关于python - 在 df.plot(kind ='hist') 中指定 bean 的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46810480/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com