
新冠疫情已经持续好几个月了,目前,我国疫情已经基本控制住了,我们会看到很多网站都提供了多种疫情统计图,今天我们使用 Python 的 pyecharts 框架来绘制一些比较常见的统计图。
1. 玫瑰图
首先,我们来绘制前段时间比较火的南丁格尔玫瑰图,数据来源我们通过接口
https://lab.isaaclin.cn/nCoV/zh
来获取,我们取疫情中死亡人数超过 2000 的国家的数据,实现代码如下:
url = 'https://lab.isaaclin.cn/nCoV/api/area'
data_json = requests.get(url).json()
country_list = []
count_list = []
ds = {}
for item in data_json['results']:
if item['countryEnglishName']:
if item['deadCount'] is not None and item['countryName'] is not None:
if int(item['deadCount']) > 2000:
d = {
item['countryName'
版权声明:本文为weixin_39795065原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。