In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-09-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article is about how Python3 can monitor the epidemic situation of COVID-19. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The code is as follows:
Import requestsimport jsonfrom pyecharts.charts import Map, Geofrom pyecharts import options as optsfrom pyecharts.globals import GeoType, RenderTypeurl = 'https://view.inews.qq.com/g2/getOnsInfo?name=disease_h6'datas = json.loads (requests.get (url=url). Json () [' data']) china = datas ['areaTree'] [0] [' children'] data = [] for i in range (len (china)): data.append China [I] ['total'] [' confirm']]) confirm = datas ['chinaTotal'] [' confirm'] suspect = datas ['chinaTotal'] [' suspect'] dead = datas ['chinaTotal'] [' dead'] heal = datas ['chinaTotal'] [' heal'] lastUpdateTime = datas ['lastUpdateTime'] print (confirm, suspect, dead LastUpdateTime) china_total = "confirmed:" + str (confirm) + "suspected:" + str (suspect) + "death:" + str (dead) + "cure:" + str (heal) + "Update date:" + lastUpdateTimegeo = (Geo (init_opts=opts.InitOpts (width= "1200px", height= "600px", bg_color= "# 404a59", page_title= "National epidemic Real-time report", renderer=RenderType.SVG, theme= "white")) # set drawing size Background color, page title, drawing type. Add _ schema (maptype= "china", itemstyle_opts=opts.ItemStyleOpts (color= "rgb (49 data_pair=data 60 data_pair=data 72)", border_color= "rgb (0memo 0)") # Map of China, map area color, region boundary color. Add (series_name= "geo", data_pair=data, type_=GeoType.EFFECT_SCATTER) # sets map data Animate the ripple special effects effect scatter.set_series_opts (# set series configuration label_opts=opts.LabelOpts (is_show=False), # do not display Labeleffect_opts=opts.EffectOpts (scale=6)) # set ripple special effect scaling .set _ global_opts (# set global series configuration # visualmap_opts=opts.VisualMapOpts (min_=0, max_=sum / len (datas)), # set visual image configuration The maximum value is the average title_opts=opts.TitleOpts (title= "National epidemic Map", subtitle=china_total, pos_left= "center", pos_top= "10px", title_textstyle_opts=opts.TextStyleOpts (color= "# fff")), # set title, subtitle, title location, text color legend_opts=opts.LegendOpts (is_show=False), # do not show legend) geo.render (path= ". / render.html") Thank you for reading! This is the end of the article on "how to monitor the epidemic situation of COVID-19 by Python3". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.