在python pandas中,我创建了一个dataframe,其中每年有一个值,还有两个子类,即参数三元组有一个度量
import pandas, requests, numpy
import matplotlib.pyplot as plt
df
Metric Tag_1 Tag_2 year
0 5770832 FOOBAR1 name1 2008
1 7526436 FOOBAR1 xyz 2008
2 33972652 FOOBAR1 name1 2009
3 17491416 FOOBAR1 xyz 2009
...
16 6602920 baznar2 name1 2008
17 6608 baznar2 xyz 2008
...
30 142102944 baznar2 name1 2015
31 0 baznar2 xyz 2015
我想用x=(year,Tag_1,Tag_2)上的y值生成一个条形图,主要对years进行排序,然后对Tag_1进行排序,并根据Tag_1对条形图进行着色。有点像
^{pr2}$我试着从一组列开始
df.plot.bar(x=['year','tag_1','tag_2']
但还没有找到一种方法,将选择分成两个相邻的酒吧组。在
您也可以这样做:
PS如果不喜欢科学记数法,你可以摆脱它:
^{pr2}$这会让你上路:
相关问题 更多 >
编程相关推荐