python-3.x - 如何用每个条的百分比绘制条形图
问题描述
我有 x 列的数据框 df , x 列有很多我想绘制的值 bar 。将 bin 中的数据从 0 到 1 2 到 3 ,4 到 5. 每个 bin 条和每个条的百分比
我现在试过了,但我不知道如何给出每个栏的百分比
out = pd.cut(xz, bins=[0,1, 2, 6,], include_lowest=True)
ax = out.value_counts(sort=False).plot.bar(rot=0, color="b", figsize=(6,4))
解决方案
推荐阅读
- perl - Perl 除法给 JavaScript 带来不同的结果
- php - Symfony\Component\Debug\Exception\FatalErrorException laravel 错误
- java - 将 Recycler 项目单元格飞到目标单击时查看?
- jquery - jQuery 简单标签内容
- c# - C# HostBuilder 日志记录配置。非通用记录器为空
- java - OpenCV Java 在 Mat 上执行算术运算
- excel - 如何计算工作表中图表的数量?
- unit-testing - 使用 JEST 和 axios-mock-adapter 测试基于 axios 的 API 时如何修复“无法验证第一个证书”?
- c++ - 与位域联合为位域成员提供了意想不到的价值
- c - 在子窗口中记录/打印