boren -疫情数据分析

import time
import requests
import matplotlib.pyplot as plt
import json
url = 'https://view.inews.qq.com/g2/getOnsInfo?name=wuwei_ww_cn_day_counts&callback=&_=%d' % int(time.time() * 1000)
paqu = json.loads(requests.get(url).json()['data'])
paqu.sort(key=lambda  x:x['date'])
print(paqu)

confirm = []
date = []
for i in paqu:
    # i 是一个字典
    confirm.append(int(i["confirm"]))
    date.append(i['date'])
# date 日期
# confirm 确诊
# suspect 疑似
# dead    死亡
# heal    治愈
print(confirm)
print(date)
# 画图
plt.plot(date,confirm)
# plt.show()
print(len(date))


s = {"ret": 0, "data": "123"}
# 拼音 --》 文字
# 索引--》 值
print(s["ret"])
print(s["data"])

s = '3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532 1712268066 1300192787 6611195909 2164201989'
# 分割语法 split
a = s.split(" ")
print(a)
# 排序  sort
a.sort()
print(a)

import time
from datetime import datetime
import requests
import matplotlib.pyplot as plt
import json

plt.rcParams['font.sans-serif'] = ['SimHei']

url = 'https://view.inews.qq.com/g2/getOnsInfo?name=wuwei_ww_cn_day_counts&callback=&_=%d' % int(time.time() * 1000)
paqu = json.loads(requests.get(url).json()['data'])
paqu.sort(key=lambda  x:x['date'])
print(paqu)

confirm = []
date = []
date_list = []
heal= []
suspect=[]
dead=[]
for i in paqu:
    # i 是一个字典
    month,day = i['date'].split("/")
    date_list.append(datetime.strptime("2020-%s-%s"%(month,day),"%Y-%m-%d"))
    confirm.append(int(i["confirm"]))
    heal.append(int(i["heal"]))
    suspect.append(int(i["suspect"]))
    dead.append(int(i["dead"]))
    date.append(i['date'])


# date 日期
# confirm 确诊
# suspect 疑似
# dead    死亡
# heal    治愈
print(confirm)
print(date)
print(date_list)
# 画图
plt.plot(date_list,confirm,label="确诊人数")
plt.plot(date_list,heal,label="治愈人数")
plt.plot(date_list,suspect,label="疑似人数")
plt.plot(date_list,dead,label="死亡人数")
# 图例
plt.legend(loc="best")
plt.xlabel("日期")
plt.ylabel("人数")
plt.title("博仁版疫情数据分析")
plt.show()
# print(len(date))




···

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
/* * File: ADC.c * Author: tlfte *AD转换,结果在C口和D口的LED上显示,能进行各种通道选择和参考电压,结果对齐方式选择 * Created on 2018年8月6日, 上午10:07 练习AD结果的计算验证,AD_RESULT=VIN×1023÷VREF,讲解887头文件的作用 */ // PIC16F887 Configuration Bit Settings // 'C' source line config statements // CONFIG1 #pragma config FOSC = XT // Oscillator Selection bits (XT oscillator: Crystal/resonator on RA6/OSC2/CLKOUT and RA7/OSC1/CLKIN) #pragma config WDTE = OFF // Watchdog Timer Enable bit (WDT disabled and can be enabled by SWDTEN bit of the WDTCON register) #pragma config PWRTE = OFF // Power-up Timer Enable bit (PWRT disabled) #pragma config MCLRE = ON // RE3/MCLR pin function select bit (RE3/MCLR pin function is digital input, MCLR internally tied to VDD) #pragma config CP = OFF // Code Protection bit (Program memory code protection is disabled) #pragma config CPD = OFF // Data Code Protection bit (Data memory code protection is disabled) #pragma config BOREN = OFF // Brown Out Reset Selection bits (BOR disabled) #pragma config IESO = OFF // Internal External Switchover bit (Internal/External Switchover mode is disabled) #pragma config FCMEN = OFF // Fail-Safe Clock Monitor Enabled bit (Fail-Safe Clock Monitor is disabled) #pragma config LVP = OFF // Low Voltage Programming Enable bit (RB3 pin has digital I/O, HV on MCLR must be used for programming) // CONFIG2 #pragma config BOR4V = BOR40V // Brown-out Reset Selection bit (Brown-out Reset set to 4.0V) #pragma config WRT = OFF // Flash Program Memory Self Write Enable bits (Write protection off) // #pragma config statements should precede project file includes. // Use project enums instead of #define for ON and OFF. #include <xc.h> #define _XTAL_FREQ 4000000 //指明时钟晶振为4MHz,使delay宏定义可以正常使用 void CSH(void); unsigned int AD_SUB(char k); void main( ) { unsigned int y; CSH(); while(1) { __delay_ms(100); //每隔100毫秒循环一次 y=AD_
最新发布
05-24
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值