【发布时间】:2016-01-19 09:24:00
【问题描述】:
作为一些基本数据分析的一部分,我正在尝试使用散景以 HTML 格式显示一些图表。使用以下代码,我使用具有 26 列和 594 行的 pandas 数据框创建了一个非常简单的条形图。 我的问题是:如何按废品价值降序排序? 现在,该图按“材料组”列的字母顺序排序。 我几乎尝试了所有方法,但我无法弄清楚...
import pandas as pd
from bokeh.charts import Bar, output_file, show
from bokeh.charts.attributes import cat
chart1 = Bar(df,values='SCRAP',
label=cat(columns='MATERIAL GROUP',sort=True),
plot_width=1250,agg='sum')
output_file('DMSY_November_2015.html')
show(chart1)
【问题讨论】:
-
如果有一个不依赖 pandas 的解决方案就好了。
标签: python python-3.x pandas bar-chart bokeh