You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
290 KiB

{
"cells": [
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"origindata:{\"lastUpdateTime\":\"2022-04-15 20:25:45\",\"chinaTotal\":{\"confirm\":515940,\"heal\":222887,\"dead\":14561,\"nowConfirm\":278492,\"suspect\":16,\"nowSevere\":76,\"importedCase\":17950,\"noInfect\":276632,\"showLocalConfirm\":1,\"showlocalinfeciton\":1,\"localConfirm\":24609,\"noInfectH5\":275843,\"localConfirmH5\":24595,\"local_acc_confirm\":174868},\"chinaAdd\":{\"confirm\":6116,\"heal\":2937,\"dead\":121,\"nowConfirm\":3058,\"suspect\":1,\"nowSevere\":-2,\"importedCase\":14,\"noInfect\":20782,\"localConfirm\":2095,\"noInfectH5\":20694,\"localConfirmH5\":3472},\"isShowAdd\":true,\"showAddSwitch\":{\"all\":true,\"confirm\":true,\"suspect\":true,\"dead\":true,\"heal\":true,\"nowConfirm\":true,\"nowSevere\":true,\"importedCase\":true,\"noInfect\":true,\"localConfirm\":true,\"localinfeciton\":true},\"areaTree\":[{\"name\":\"中国\",\"today\":{\"confirm\":6116,\"isUpdated\":true},\"total\":{\"nowConfirm\":278492,\"confirm\":515940,\"dead\":14561,\"showRate\":false,\"heal\":222887,\"showHeal\":true,\"wzz\":0,\"provinceLocalConfirm\":0},\"children\":[{\"name\":\"香港\",\"today\":{\"confirm\":352,\"confirmCuts\":0,\"isUpdated\":true,\"tip\":\"\",\"wzz_add\":0},\"total\":{\"nowConfirm\":236339,\"confirm\":309119,\"dead\":9069,\"showRate\":false,\"heal\":63711,\"showHeal\":true,\"wzz\":0,\"provinceLocalConfirm\":0},\"children\":[{\"name\":\"地区待确认\",\"today\":{\"confirm\":352,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":236339,\"confirm\":309119,\"dead\":9069,\"showRate\":false,\"heal\":63711,\"showHeal\":true,\"wzz\":0,\"provinceLocalConfirm\":0}}]},{\"name\":\"台湾\",\"today\":{\"confirm\":2264,\"confirmCuts\":0,\"isUpdated\":true,\"tip\":\"\",\"wzz_add\":0},\"total\":{\"nowConfirm\":17261,\"confirm\":31857,\"dead\":854,\"showRate\":false,\"heal\":13742,\"showHeal\":true,\"wzz\":0,\"provinceLocalConfirm\":0},\"children\":[{\"name\":\"地区待确认\",\"today\":{\"confirm\":2264,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":17261,\"confirm\":31857,\"dead\":854,\"showRate\":false,\"heal\":13742,\"showHeal\":true,\"wzz\":0,\"provinceLocalConfirm\":0}}]},{\"name\":\"上海\",\"today\":{\"confirm\":3200,\"confirmCuts\":0,\"isUpdated\":true,\"tip\":\"\",\"wzz_add\":19872},\"total\":{\"nowConfirm\":12301,\"confirm\":20244,\"dead\":7,\"showRate\":false,\"heal\":7936,\"showHeal\":true,\"wzz\":246233,\"provinceLocalConfirm\":15676},\"children\":[{\"name\":\"浦东\",\"today\":{\"confirm\":1252,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":5090,\"confirm\":6123,\"dead\":1,\"showRate\":false,\"heal\":1032,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"闵行\",\"today\":{\"confirm\":274,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":1430,\"confirm\":1802,\"dead\":0,\"showRate\":false,\"heal\":372,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"松江\",\"today\":{\"confirm\":178,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":967,\"confirm\":1033,\"dead\":0,\"showRate\":false,\"heal\":66,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"徐汇\",\"today\":{\"confirm\":293,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":948,\"confirm\":1081,\"dead\":1,\"showRate\":false,\"heal\":132,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"黄浦\",\"today\":{\"confirm\":268,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":947,\"confirm\":1030,\"dead\":0,\"showRate\":false,\"heal\":83,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"虹口\",\"today\":{\"confirm\":174,\"confirmCuts\":0,\"isUpdated\":true},\"total\":{\"nowConfirm\":510,\"confirm\":558,\"dead\":0,\"showRate\":false,\"heal\":48,\"showHeal\":true,\"grade\":\"点击查看详情\",\"wzz\":0,\"provinceLocalConfirm\":0}},{\"name\":\"长宁\",\"today\":{\"confirm\":148,\"confi
"status code:200\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"datas:\n",
"{'lastUpdateTime': '2022-04-15 20:25:45', 'chinaTotal': {'confirm': 515940, 'heal': 222887, 'dead': 14561, 'nowConfirm': 278492, 'suspect': 16, 'nowSevere': 76, 'importedCase': 17950, 'noInfect': 276632, 'showLocalConfirm': 1, 'showlocalinfeciton': 1, 'localConfirm': 24609, 'noInfectH5': 275843, 'localConfirmH5': 24595, 'local_acc_confirm': 174868}, 'chinaAdd': {'confirm': 6116, 'heal': 2937, 'dead': 121, 'nowConfirm': 3058, 'suspect': 1, 'nowSevere': -2, 'importedCase': 14, 'noInfect': 20782, 'localConfirm': 2095, 'noInfectH5': 20694, 'localConfirmH5': 3472}, 'isShowAdd': True, 'showAddSwitch': {'all': True, 'confirm': True, 'suspect': True, 'dead': True, 'heal': True, 'nowConfirm': True, 'nowSevere': True, 'importedCase': True, 'noInfect': True, 'localConfirm': True, 'localinfeciton': True}, 'areaTree': [{'name': '中国', 'today': {'confirm': 6116, 'isUpdated': True}, 'total': {'nowConfirm': 278492, 'confirm': 515940, 'dead': 14561, 'showRate': False, 'heal': 222887, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}, 'children': [{'name': '香港', 'today': {'confirm': 352, 'confirmCuts': 0, 'isUpdated': True, 'tip': '', 'wzz_add': 0}, 'total': {'nowConfirm': 236339, 'confirm': 309119, 'dead': 9069, 'showRate': False, 'heal': 63711, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}, 'children': [{'name': '地区待确认', 'today': {'confirm': 352, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 236339, 'confirm': 309119, 'dead': 9069, 'showRate': False, 'heal': 63711, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}}]}, {'name': '台湾', 'today': {'confirm': 2264, 'confirmCuts': 0, 'isUpdated': True, 'tip': '', 'wzz_add': 0}, 'total': {'nowConfirm': 17261, 'confirm': 31857, 'dead': 854, 'showRate': False, 'heal': 13742, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}, 'children': [{'name': '地区待确认', 'today': {'confirm': 2264, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 17261, 'confirm': 31857, 'dead': 854, 'showRate': False, 'heal': 13742, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}}]}, {'name': '上海', 'today': {'confirm': 3200, 'confirmCuts': 0, 'isUpdated': True, 'tip': '', 'wzz_add': 19872}, 'total': {'nowConfirm': 12301, 'confirm': 20244, 'dead': 7, 'showRate': False, 'heal': 7936, 'showHeal': True, 'wzz': 246233, 'provinceLocalConfirm': 15676}, 'children': [{'name': '浦东', 'today': {'confirm': 1252, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 5090, 'confirm': 6123, 'dead': 1, 'showRate': False, 'heal': 1032, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '闵行', 'today': {'confirm': 274, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 1430, 'confirm': 1802, 'dead': 0, 'showRate': False, 'heal': 372, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '松江', 'today': {'confirm': 178, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 967, 'confirm': 1033, 'dead': 0, 'showRate': False, 'heal': 66, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '徐汇', 'today': {'confirm': 293, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 948, 'confirm': 1081, 'dead': 1, 'showRate': False, 'heal': 132, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '黄浦', 'today': {'confirm': 268, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 947, 'confirm': 1030, 'dead': 0, 'showRate': False, 'heal': 83, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '虹口', 'today': {'confirm': 174, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 510, 'confirm': 558, 'dead': 0, 'showRate': False, 'heal': 48, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}, {'name': '长宁', 'today': {'confirm': 148, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 490, 'confirm': 602, 'dead': 0, 'sh
"dict_keys(['lastUpdateTime', 'chinaTotal', 'chinaAdd', 'isShowAdd', 'showAddSwitch', 'areaTree'])\n",
"34\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"香港 台湾 上海 吉林 浙江 广东 福建 山东 四川 江苏 海南 黑龙江 广西 北京 山西 河北 陕西 云南 辽宁 河南 青海 安徽 湖南 江西 内蒙古 天津 湖北 贵州 重庆 西藏 新疆 澳门 宁夏 甘肃 \n",
"\n",
"{'name': '滨州', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 72, 'confirm': 217, 'dead': 0, 'showRate': False, 'heal': 145, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '济南', 'today': {'confirm': 2, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 39, 'confirm': 90, 'dead': 0, 'showRate': False, 'heal': 51, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '青岛', 'today': {'confirm': 4, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 22, 'confirm': 986, 'dead': 1, 'showRate': False, 'heal': 963, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '德州', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 10, 'confirm': 112, 'dead': 2, 'showRate': False, 'heal': 100, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '临沂', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 8, 'confirm': 66, 'dead': 0, 'showRate': False, 'heal': 58, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '潍坊', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 8, 'confirm': 52, 'dead': 0, 'showRate': False, 'heal': 44, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '境外输入', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 8, 'confirm': 435, 'dead': 0, 'showRate': False, 'heal': 427, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '威海', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 6, 'confirm': 107, 'dead': 1, 'showRate': False, 'heal': 100, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '日照', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 5, 'confirm': 37, 'dead': 0, 'showRate': False, 'heal': 32, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '枣庄', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': True}, 'total': {'nowConfirm': 4, 'confirm': 33, 'dead': 0, 'showRate': False, 'heal': 29, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '烟台', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 3, 'confirm': 85, 'dead': 0, 'showRate': False, 'heal': 82, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '济宁', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 3, 'confirm': 263, 'dead': 0, 'showRate': False, 'heal': 260, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '淄博', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 1, 'confirm': 77, 'dead': 1, 'showRate': False, 'heal': 75, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '聊城', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 0, 'confirm': 38, 'dead': 0, 'showRate': False, 'heal': 38, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '菏泽', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 0, 'confirm': 20, 'dead': 0, 'showRate': False, 'heal': 20, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '泰安', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': 0, 'confirm': 43, 'dead': 2, 'showRate': False, 'heal': 41, 'showHeal': True, 'grade': '点击查看详情', 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'name': '地区待确认', 'today': {'confirm': 0, 'confirmCuts': 0, 'isUpdated': False}, 'total': {'nowConfirm': -16, 'confirm': 0, 'dead': 0, 'showRate': False, 'heal': 16, 'showHeal': True, 'wzz': 0, 'provinceLocalConfirm': 0}}\n",
"{'香港': 309119, '台湾': 31857, '上海': 20244, '吉林': 38803, '浙江': 2880, '广东': 6821, '福建': 2958, '山东': 2661, '四川': 1974, '江苏': 2120, '海南': 283, '黑龙江': 2522, '广西': 1541, '北京': 1831, '山西': 368, '河北': 1984, '陕西': 3261, '云南': 2095, '辽宁': 1609, '河南': 2851, '青海': 50, '安徽': 1058, '湖南': 1337, '江西': 1070, '内蒙古': 1690, '天津': 1800, '湖北': 68395, '贵州': 178, '重庆': 694, '西藏': 1, '新疆': 999, '澳门': 82, '宁夏': 122, '甘肃': 681}\n",
"滨州\n",
"\n",
"217\n",
"济南\n",
"\n",
"90\n",
"青岛\n",
"\n",
"986\n",
"德州\n",
"\n",
"112\n",
"临沂\n",
"\n",
"66\n",
"潍坊\n",
"\n",
"52\n",
"境外输入\n",
"\n",
"435\n",
"威海\n",
"\n",
"107\n",
"日照\n",
"\n",
"37\n",
"枣庄\n",
"\n",
"33\n",
"烟台\n",
"\n",
"85\n",
"济宁\n",
"\n",
"263\n",
"淄博\n",
"\n",
"77\n",
"聊城\n",
"\n",
"38\n",
"菏泽\n",
"\n",
"20\n",
"泰安\n",
"\n",
"43\n",
"地区待确认\n",
"\n",
"0\n",
"{'滨州': 217, '济南': 90, '青岛': 986, '德州': 112, '临沂': 66, '潍坊': 52, '境外输入': 435, '威海': 107, '日照': 37, '枣庄': 33, '烟台': 85, '济宁': 263, '淄博': 77, '聊城': 38, '菏泽': 20, '泰安': 43, '地区待确认': 0}\n"
]
},
{
"data": {
"image/png": "iVBORw0KGgoAAAANSUhEUgAAAm8AAAGaCAYAAABZgaS/AAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XmYXGWZ9/HvnZWERQKJiKwBcQFlM6CAjCggUUeIOiIa\nlUVEGcERVFYdQAENr2wqKDgsibIYkAHRYQmogIKEQECIGhL2PWELImQh3O8fz2lSdKrTCaSr+iTf\nz3X11VWnTp3nqaW7fvVsJzITSZIk1UOfdldAkiRJi8/wJkmSVCOGN0mSpBoxvEmSJNWI4U2SJKlG\nDG+SJEk1YniT1HYRsX5EvLcHjrtGRGzaA8cdHBG7RMRi/w+NiLUjYmRErLqIfTaPiB2XTi0lLasM\nb1KNRMSbI+L+iPjcIvYZHBGDliRYNNy3b0SsGBGDl6A+syPipCUtq5P9gZsiYpfXeZzOfgtMiIj1\nlvJxTwWuBLZcgvtsB1wBbAQQEf0iYqWI6NewzzeBX3ZcadhnhcYDRcSHI+Jt1eUjI+Kl6nUbFBHf\niYhh1W0/iYgLImLl7ioXEUMiYnpE7L0Ej2mpqB7jpRFxWBe3HxsRFy3i/ndGxA09V0Opd+nX/S6S\nelpEbAKc2OSmYzLzpobrs4H1gEGLONzpwJ7VcV9rlc4AvtLshoh4E/BElhW+5wEDgfmd9hkF/C4z\n53VXUET0Bz4LXJOZV73WCndhH+Bm4BcRsUNmvrwkd46ItYBmweeu6venI+L5xrtQ/q+uAPw1M+c0\n3PZs9btj2w7AhKqczuV2Xj39O8Cx1W19KCHvLRHxbspz35fy3vg8cCRwbnW/7YEBmfnPRT9SAOYC\nGwIDGupxLfDBbu73ZGYOW4zjL8psYDfg+S5u3xx4zyLuPwh48XXWQaoNw5vUO6wA7AKcBtxP+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AnSjfX5c2fpqYeZkG46uzNwDNNtt9O6VrrXL+O5+RcXt1Numv1u3MX3EvA\nJhGxEfAm4LaGLr9/o3QPNx7/9oj4b8rr2dG92Ow1DEp4WwF4rGqBOw74FmXiyO4smIDyA+DdlFnL\nHV2mmzUc681VGY1jCpsZHBHfpbQYNvMvGmZ2Vq18gzKzI3CuDGwDfCIi3leFxw9TAt/d1X3Wz8z7\nu6lHZ8+xoLWzP1XLGwta7/pRxtqd0uw9Jy1LDG9S7/NFSrfVT6qB50np6rqr035jKd1TkyNiEECn\nWXWdx2YNp6xNtiivmu1XhYVRlBao7SjdnJ3XgHszcET109mJlMkXC+kIblHWMPskJYRsRwmvvwUO\nB6ZHxG8pkxaub2wxauIF4CHgu522n0YJv822dzlWMCLeSulqvLcaa3gS5bX5K50mAVC6BA9hQdfo\nwOoYq1K6VK/ufPzMnBkRo2lY160Lx2XmtxvqdRklPB0PrENZ3uMISoj5HCUsXk4JpiMiom81WH8t\n4OFFzLwcUv0+kTJO7OvAfwIjI+LTnXeOiM93ur5yZj6fmc9EWWj4OuCqiNgW+DjVcxYRH6CMg/xg\nZv6583EX4Z+ZeWyzG6pe5UmZ2ew9KC1zXKRX6mUy8znKB/OHKWOaXqAEgCcokxWgDMKfBVxDGav0\nAqXVodEr44mirM32TqputyWoSwIfogxAX5UFY6WGZGYs6ofSmtTV8g2rRcSnIqJjMsFZlC6vEZn5\nicw8mzLIfG9K69444IGIeDwirouIo5ocdj6ldefCxh9K0Olqe+eWPyJio4gYRwnGWwBzqlalW6rH\nv0t2Wr8uM4/PzFUprWT9OoJpZj6bmV/MzN938RR3BKkdKK2onX9eYOGxdHdRXus+lND7JeDazJxX\nvXeeAa6iLMGyCjCiut/mlK70zo93YET8Jwu6038JbJKZl1NmMJ/dqU5/pHTZdlx/F2V82iuhsGr5\nGklpGbuRsmzKJdXNNwE
"text/plain": [
"<matplotlib.figure.Figure at 0x1fdc87f52e8>"
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# -*- coding: utf-8 -*-\n",
"import time, json, requests\n",
"import matplotlib.pyplot as plt\n",
"import numpy as np\n",
"\n",
"# 抓取腾讯疫情实时json数据\n",
"url = 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5&callback=&_=%d' % int(time.time() * 1000)\n",
"origindatas = requests.get(url=url)\n",
"print(\"origindata:\" + origindatas.json()['data']) # 将抓取的数据转换为json格式并获取里面的数据\n",
"print(\"status code:\" + str(origindatas.status_code)) # 获取数据的返回状态\n",
"data = json.loads(requests.get(url=url).json()['data'])\n",
"print(\"datas:\")\n",
"print(str(data))\n",
"print(data.keys())\n",
"\n",
"# 统计省份信息(34个省份 湖北 广东 河南 浙江 湖南 安徽....)\n",
"c_datas = data['areaTree'][0]['children']\n",
"print(len(c_datas))\n",
"for item in c_datas:\n",
" print(item['name'], end=\" \") # 获取每个省的省名称\n",
"else:\n",
" print(\"\\n\")\n",
"\n",
"# 显示陕西省的数据\n",
"shanxi = c_datas[7]['children']\n",
"for data in shanxi:\n",
" print(data)\n",
"# 解析json数据\n",
"total_datas = {}\n",
"shanxi_datas = {}\n",
"for data in c_datas:\n",
" if data['name'] not in total_datas:\n",
" total_datas.update({data['name']: 0})\n",
" for province_data in data['children']: # 获取每个省份确认的数据\n",
" total_datas[data['name']] += int(province_data['total']['confirm'])\n",
"print(total_datas)\n",
"# 以陕西省为例获取每个市的数据\n",
"for sx in shanxi:\n",
" print(sx['name'] + \"\\n\")\n",
" print(int(sx['total']['confirm']))\n",
" shanxi_datas[sx['name']] = int(sx['total']['confirm'])\n",
"print(shanxi_datas)\n",
"\n",
"names = range(len(shanxi_datas.keys()))\n",
"nums = shanxi_datas.values()\n",
"\n",
"# 绘制条形图\n",
"plt.figure(figsize=[10, 6])\n",
"plt.bar(names, nums, width=0.3, color='green')\n",
"# 设置标题\n",
"plt.xlabel(\"地区\", fontproperties='SimHei', rotation=90, size=12)\n",
"plt.ylabel(\"人数\", fontproperties='SimHei', size=12)\n",
"plt.title(\"陕西省各市疫情数据对比\", fontproperties='SimHei', size=20)\n",
"plt.xticks(list(names), fontproperties='SimHei', rotation=-45, size=10)\n",
"# 每个图形上显示数据\n",
"for a, b in zip(list(names), list(nums)):\n",
" plt.text(a, b, b, ha='center', va='bottom', size=6)\n",
"plt.show()\n"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"ename": "KeyError",
"evalue": "'suspect'",
"output_type": "error",
"traceback": [
"\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[1;31mKeyError\u001b[0m Traceback (most recent call last)",
"\u001b[1;32m<ipython-input-4-b78b1ba47bd9>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m 70\u001b[0m \u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 71\u001b[0m \u001b[1;32mif\u001b[0m \u001b[0m__name__\u001b[0m \u001b[1;33m==\u001b[0m \u001b[1;34m'__main__'\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 72\u001b[1;33m \u001b[0mchina_virus_data\u001b[0m \u001b[1;33m=\u001b[0m \u001b[0mget_virus_data\u001b[0m\u001b[1;33m(\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 73\u001b[0m \u001b[0mdraw_virus_map\u001b[0m\u001b[1;33m(\u001b[0m\u001b[0mchina_virus_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m \u001b[0mchina_virus_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m1\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m)\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
"\u001b[1;32m<ipython-input-4-b78b1ba47bd9>\u001b[0m in \u001b[0;36mget_virus_data\u001b[1;34m()\u001b[0m\n\u001b[0;32m 24\u001b[0m virus_map_title = \"数据更新时间:{} 当前确诊人数:{} 疑似人数:{} 死亡人数:{} 治愈人数:{}\".format(response_data[\"lastUpdateTime\"],\n\u001b[0;32m 25\u001b[0m \u001b[0mresponse_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"areaTree\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"total\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"confirm\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m---> 26\u001b[1;33m \u001b[0mresponse_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"areaTree\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"total\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"suspect\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m 27\u001b[0m \u001b[0mresponse_data\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"areaTree\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;36m0\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"total\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m[\u001b[0m\u001b[1;34m\"dead\"\u001b[0m\u001b[1;33m]\u001b[0m\u001b[1;33m,\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0;32m 28\u001b[0m response_data[\"areaTree\"][0][\"total\"][\"heal\"],)\n",
"\u001b[1;31mKeyError\u001b[0m: 'suspect'"
]
}
],
"source": [
"import requests\n",
"import json\n",
"from pyecharts.charts import Map\n",
"from pyecharts import options as opts\n",
"\n",
"\n",
"def get_virus_data():\n",
" \"\"\"\n",
" 获取疫情数据\n",
" :return:\n",
" \"\"\"\n",
" url = \"https://view.inews.qq.com/g2/getOnsInfo?name=disease_h5\"\n",
" headers = {\n",
" \"User-Agent\": \"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.92 Safari/537.36\"}\n",
"\n",
" response = requests.get(url, headers=headers)\n",
" response_data = json.loads(response.json()[\"data\"])\n",
" china_virus_list = response_data[\"areaTree\"][0][\"children\"]\n",
" china_virus_dict = {}\n",
" for province_virus_data in china_virus_list:\n",
" china_virus_dict[province_virus_data[\"name\"]] = province_virus_data[\"total\"][\"confirm\"]\n",
"\n",
"\n",
" virus_map_title = \"数据更新时间:{} 当前确诊人数:{} 疑似人数:{} 死亡人数:{} 治愈人数:{}\".format(response_data[\"lastUpdateTime\"],\n",
" response_data[\"areaTree\"][0][\"total\"][\"confirm\"],\n",
" response_data[\"areaTree\"][0][\"total\"][\"suspect\"],\n",
" response_data[\"areaTree\"][0][\"total\"][\"dead\"],\n",
" response_data[\"areaTree\"][0][\"total\"][\"heal\"],)\n",
" return china_virus_dict, virus_map_title\n",
"\n",
"\n",
"def draw_virus_map(virus_data, virus_title):\n",
" \"\"\"\n",
" 绘制疫情地图\n",
" :param virus_title:\n",
" :param virus_data:\n",
" :return:\n",
" \"\"\"\n",
" virus_map = Map()\n",
" virus_data_list = []\n",
" \"\"\"\n",
" A = [1,2,3]\n",
" B = [4,5,6]\n",
" zip(A, B)\n",
" (1,4),(2,5),(3,6)\n",
" \"\"\"\n",
" virus_zip = zip(virus_data.keys(), virus_data.values())\n",
" for z in virus_zip:\n",
" print(z)\n",
" virus_data_list.append(z)\n",
"\n",
" virus_map.add(virus_title, virus_data_list, \"china\")\n",
" virus_map.set_global_opts(title_opts=opts.TitleOpts(\"中国疫情地图\"),\n",
" visualmap_opts=opts.VisualMapOpts(split_number=6,is_piecewise=True,\n",
" pieces=[{\"min\": 1, \"max\": 9, \"label\": \"1-9人\",\n",
" \"color\": \"#ffefd7\"},\n",
" {\"min\": 10, \"max\": 99, \"label\": \"10-99人\",\n",
" \"color\": \"#ffd2a0\"},\n",
" {\"min\": 100, \"max\": 499, \"label\": \"100-499人\",\n",
" \"color\": \"#fe8664\"},\n",
" {\"min\": 500, \"max\": 999, \"label\": \"500-999人\",\n",
" \"color\": \"#e64b47\"},\n",
" {\"min\": 1000, \"max\": 9999,\n",
" \"label\": \"1000-9999人\", \"color\": \"#c91014\"},\n",
" {\"min\": 10000, \"label\": \"10000人及以上\",\n",
" \"color\": \"#9c0a0d\"}]),\n",
" tooltip_opts=opts.TooltipOpts(formatter=\"{b}:{c}\"))\n",
" virus_map.render(path=\"疫情地图.html\")\n",
"\n",
"\n",
"if __name__ == '__main__':\n",
" china_virus_data = get_virus_data()\n",
" draw_virus_map(china_virus_data[0], china_virus_data[1])"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.6.1"
}
},
"nbformat": 4,
"nbformat_minor": 2
}