【发布时间】:2022-01-15 07:28:54
【问题描述】:
result 是 pandas 数据帧,在 Total Academic Expectations Score 和 Parent Response Rate 上具有 float64 值。
它确实制作了 Plot,但在 x 轴而不是浮点数上它只显示 0。
DataFrame 如下所示:(c 的行数要多得多)
| DBN | Total Academic Expectations Score | Parent Response Rate | |
|---|---|---|---|
| 0 | 01M015 | 8.2 | 0.71 |
| 0 | 01M019 | 7.7 | 0.92 |
result['Total Academic Expectations Score'].groupby(result['Parent Response Rate']).plot(kind ='bar')
plt.tight_layout()
plt.show()
我尝试过如图所示的紧凑布局,但没有成功。
注意:Parent Response Rate 是 0 到 1 浮点数,Total Academic Expectations Score 是 0 到 10 浮点数
我想显示相同家长回复率的总学术期望分数的平均值是多少
【问题讨论】:
-
您应该提供一个最小的可重现示例,而不是数据的文字描述
-
对于相同的家长响应率,您要显示什么?总学术期望分数的平均值、总和、其他?
-
@Corralien 已更新(我想看看它的意思),代码中有一个确切的逻辑问题,所以我已经修复了,谢谢。
标签: python pandas matplotlib