Python笔记:爬虫制作“我国疫情累计确诊人数分布图”
代码: import requests from pyecharts.charts import * from pyecharts import options as opts url = "https://lab.isaaclin.cn/nCoV/api/area" data = requests.get(url).json() province_data = [] for item in data["results"]: if item["countryName"] == "中国": province_data.append((item["provinceShortName"], item["confirmedCount"])) china_map = ( Map(init_opts=opts.InitOpts(theme = "dark")) .add("确诊人数", province_data, "china",is_map_symbol_show=False, is_roam=False) .set_series_opts(label_opts=opts.LabelOpts(is_show = True, color = "#ffffff")) .set_global_opts( title_opts=opts.TitleOpts(title=