假设我试图将年龄绘制为具有密度计数的直方图:ax = inputs['Age'].plot(kind='hist', bins=10, range = (20,100), grid=True, density=True)有没有办法从返回的每个条柱的密度中获取计算的y值?还是我必须为每个箱子单独计算它们?
1 回答

慕田峪4524236
TA贡献1875条经验 获得超5个赞
虽然不返回箱子,但确实如此。因此,如果要获得完全相同的绘图和素材箱,则可以使用:pandas.Series.plotmatplotlib.pyplot.hist
bins, values, _ = ax.hist(inputs['Age'], bins=10, range = (20,100), density = True)
ax.grid() # there is no grid=True option in matplotlib.pyplot.hist
添加回答
举报
0/150
提交
取消