|
|
@ -128,7 +128,7 @@ dataWorld = dataWorld.sort_values(by=['Country/Region','group_var']).reset_index |
|
|
|
dataWorld = dataWorld.pivot_table(index=['Country/Region'], columns='group_var') |
|
|
|
dataWorld.columns = dataWorld.columns.droplevel().rename(None) |
|
|
|
|
|
|
|
#中国各省份 |
|
|
|
#中国省份(bottom 12) |
|
|
|
dataChina.sort_values('Confirmed', inplace=True) |
|
|
|
xData = [] |
|
|
|
yConfirmed = [] |
|
|
@ -150,20 +150,42 @@ ax5.legend() |
|
|
|
|
|
|
|
plt.show() |
|
|
|
|
|
|
|
ChinaConfirmed=[] |
|
|
|
worldConfirmed=[] |
|
|
|
#中国疫情图 |
|
|
|
ChinaConfirmed = [] |
|
|
|
ChinaProvince = [] |
|
|
|
worldConfirmed = [] |
|
|
|
provinceNameMap = {'Tibet':'西藏', 'Qinghai':'青海', 'Macau':'澳门', 'Ningxia':'宁夏', 'Jilin':'吉林', 'Guizhou':'贵州', |
|
|
|
'Gansu':'甘肃', 'Hainan':'海南', 'Shanxi':'山西', 'Yunnan':'云南', 'Liaoning':'辽宁', 'Tianjin':'天津', |
|
|
|
'Inner Mongolia':'内蒙古', 'Guangxi':'广西', 'Shaanxi':'陕西', 'Hebei':'河北', 'Fujian':'福建', 'Xinjiang':'新疆', |
|
|
|
'Chongqing':'重庆', 'Sichuan':'四川', 'Jiangsu':'江苏', 'Beijing':'北京', 'Shanghai':'上海', 'Shandong':'山东', |
|
|
|
'Heilongjiang':'黑龙江', 'Jiangxi':'江西', 'Anhui':'安徽', 'Hunan':'湖南', 'Zhejiang':'浙江', 'Henan':'河南', |
|
|
|
'Guangdong':'广东', 'Hong Kong':'香港', 'Hubei':'湖北'} |
|
|
|
|
|
|
|
for i in range(33): |
|
|
|
ChinaConfirmed.append((dataChina.index[i],dataChina['Confirmed'][i])) |
|
|
|
ChinaConfirmed.append(dataChina['Confirmed'][i]) |
|
|
|
ChinaProvince.append(provinceNameMap[dataChina.index[i]]) |
|
|
|
|
|
|
|
|
|
|
|
map_China = Map() |
|
|
|
map_China.set_global_opts(title_opts=options.TitleOpts(title="疫情图-确诊人数"), |
|
|
|
visualmap_opts=options.VisualMapOpts(is_piecewise=True, |
|
|
|
pieces=[ |
|
|
|
{"min": 1000, "label": '>1000人',"color": "#6F171F"}, |
|
|
|
{"min": 500, "max": 1000,"label": '500-1000人', "color": "#C92C34"}, |
|
|
|
{"min": 100, "max": 499,"label": '100-499人', "color": "#E35B52"}, |
|
|
|
{"min": 10, "max": 99,"label": '10-99人', "color": "#F39E86"}, |
|
|
|
{"min": 1, "max": 9, "label": '1-9人', "color": "#FDEBD0"}])) |
|
|
|
map_China.add("确诊", ChinaConfirmed, maptype='china') |
|
|
|
map_China.render("province.html") |
|
|
|
map_China.set_global_opts(title_opts=options.TitleOpts(title="中国(大陆)疫情图-总确诊人数"), |
|
|
|
legend_opts=options.LegendOpts(is_show=False), |
|
|
|
visualmap_opts=options.VisualMapOpts(max_=200000)) |
|
|
|
map_China.add("",[list(z) for z in zip(ChinaProvince, ChinaConfirmed)], maptype='china') |
|
|
|
map_China.render("China.html") |
|
|
|
|
|
|
|
#世界地图 |
|
|
|
worldConfirmed = [] |
|
|
|
worldName = [] |
|
|
|
for i in range(dataWorld.shape[0]): |
|
|
|
worldConfirmed.append(dataWorld['Confirmed'][i]) |
|
|
|
if dataWorld.index[i] == 'US': |
|
|
|
worldName.append('United States') |
|
|
|
else: |
|
|
|
worldName.append(dataWorld.index[i]) |
|
|
|
|
|
|
|
map_world = Map() |
|
|
|
map_world.set_global_opts(title_opts=options.TitleOpts(title="世界疫情图-总确诊人数"), |
|
|
|
legend_opts=options.LegendOpts(is_show=True), |
|
|
|
visualmap_opts=options.VisualMapOpts(min_=10000,max_=80000000)) |
|
|
|
map_world.add("",[list(z) for z in zip(worldName, worldConfirmed)], maptype='world') |
|
|
|
map_world.render("world.html") |