旅游 = 旅游名称
开始 = 开始时的可用预订
结束 = 剩余预订量
csv 文件列:
ID | Tour | Start | End
12345 | Italy | 100 | 80
13579 | China | 50 | 30
24680 | France | 50 | 30
到目前为止我有这个
import pandas as pd
df = pd.read_csv("items4.csv",sep=",").set_index('ID')
d = dict(zip(df.index,df.values.tolist()))
print(d)
{12345: ['Italy', 100, 80], 13579: ['China', 50, 30], 24680: ['France', 50, 30]} #This is the output
我想制作一个看起来像这样的条形图this https://i.stack.imgur.com/iQaHU.jpg有了这个给定的数据。
IIUC,请致电set_index
and plot.bar
:
df
ID Tour Start End
0 12345 Italy 100 80
1 13579 China 50 30
2 24680 France 50 30
df.set_index('Tour')[['Start', 'End']].plot.bar()
plt.show()
如果您有兴趣注释酒吧也有,看看在 Pandas 条形图上用值注释条形 https://stackoverflow.com/questions/25447700/annotate-bars-with-values-on-pandas-bar-plots.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)