python - 在堆积条形图 pandas 中显示值
问题描述
我有这个熊猫数据框:
production consumption
year
2013 0.426669 0.573331
2014 0.436364 0.563636
2015 0.419941 0.580059
2016 0.448378 0.551622
2017 0.442212 0.557788
2018 0.422724 0.577276
2019 0.445296 0.554704
我使用df.plot.bar(stacked=True)函数绘制堆积条形图
生产和消费的百分比
是否可以将百分比添加到条形图中?
解决方案
推荐阅读
- python - 如何连接正则表达式模式?
- sql - SQL 按条件将最新事件连接到缺失值
- java - 如何在 Spring Boot 中通知特定线程
- sql - 跨越多行的 SQL 条件
- php - 用于树莓派 echo 命令的 php 脚本慢
- rest - 尝试使用 Power BI REST API - Invoke-RestMethod 时出错:找不到接受参数的位置参数
- javascript - 无法仅使用 Javascript 更改 img 标签内的 id 或 src 属性
- javascript - 具有共享名称的 Javascript 对象
- arrays - 通过对象数组映射在 React 中不起作用
- regex - 我想使用正则表达式匹配 Python 中的两个 Url,但是下面的代码给出了错误。我不知道为什么