python - Add error bar to a single column in pandas plot
问题描述
I have a dataframe which looks like this:
df = pd.DataFrame({'Pred': [10, 9.5, 9.8], 'Actual': [10.2, 9.9, 9.1], 'STD': [0.1, 0.2, 0.6]})
Pred Actual STD
0 10.0 10.2 0.1
1 9.5 9.9 0.2
2 9.8 9.1 0.6
I want to make a bar plot with error bars using STD
only on the Pred
column, and not on the Actual
column. So far I have this:
df.plot.bar(yerr='STD', capsize=4)
but this adds the error bars on both Actual
and Pred
. Is there a straight forward way to tell Pandas to add the erorr bar to a single column?
解决方案
推荐阅读
- angular - Angular 12 aws-sdk 2.910.0 错误:找不到模块:错误:无法解析 '.\.\.\node_modules\aws-sdk\lib' 中的 'util'
- r - 汇集来自插补的结果以获得具有边际效应的回归
- jquery - 数组中的总和值不起作用 - jQuery
- python - Selenium 使用 python 将网站值保存在变量中
- php - laravel 与 where 子句进行预测
- amazon-web-services - 有没有办法在 AWS DMS Task 上使用表达式来动态过滤日期列?
- go - 根据 Bazel 的 Godror 构建,使用 rules_go 和 CGO 从您的应用程序或服务访问 Oracle
- javascript - 根据元素之间的关系从数组中删除元素
- javascript - 在反应钩子中设置 setState
- xslt - XSLT:覆盖 fn:generate-id 函数以使用 Saxon 创建可预测的结果