Cov txheej txheem:

Covid Live Qhia Siv Raspberry Pi: 6 Kauj Ruam
Covid Live Qhia Siv Raspberry Pi: 6 Kauj Ruam

Video: Covid Live Qhia Siv Raspberry Pi: 6 Kauj Ruam

Video: Covid Live Qhia Siv Raspberry Pi: 6 Kauj Ruam
Video: tuav wb lub neej kom ruaj khov - Mang Vang ft. Christina Xyooj [Official Audio] 2021-22 2024, Hlis ntuj nqeg
Anonim
Covid Live Qhia Siv Raspberry Pi
Covid Live Qhia Siv Raspberry Pi

Raws li peb paub thoob ntiaj teb tau cuam tshuam los ntawm COVID-19 muaj thoob qhov txhia chaw thiab yuav luag txhua tus neeg ua haujlwm hauv tsev. Peb txhua tus yuav tsum siv lub sijhawm no kom zoo tshaj plaws, txhawm rau txhim kho peb cov txuj ci txuj ci lossis sau qee cov ntawv Pythonic zoo. Los saib cov ntawv Python yooj yim los qhia txog lub xeev-paub tus kab mob corona tus kab mob hauv Is Nrias teb. Cov ntawv Python no khaws cov ntaub ntawv muaj nyob los ntawm Ministry of Health Affairs Official Website.

Khoom siv

Raspberry pi 3b+

SD daim npav (min 16GB)

HDMI kab

Ethernet cable

internet kev twb kev txuas

yog tias koj yog thawj zaug hauv raspberry pi koj yuav tsum teeb tsa nws:-

lwm yam kev xav tau

viusal stdio code (nab nab ide) txuas ntawm no:-

Kauj Ruam 1: Teeb Raspberry Pi

Nco ntsoov tias OS tau teeb tsa ntawm SD Card. Koj SD yuav muaj Raspberry Pi Operating System teeb tsa. … Kho lub Wifi Txuas ntawm Koj Daim Npav SD. … Qhib Koj Lub Raspberry Pi. … Txuas rau Koj Raspberry Pi nrog SSH. … Nruab VNC Server. … Nruab VNC Viewer ntawm Koj Lub Laptop.

Txhawm rau khiav qhov program

Ua ntej peb pib sau software peb xub xav tau los nruab Raspberry Pi GPIO Python module. Nov yog lub tsev qiv ntawv uas tso cai rau peb nkag mus rau GPIO chaw nres nkoj ncaj qha los ntawm Python.

Txhawm rau nruab Python lub tsev qiv ntawv qhib lub davhlau ya nyob twg thiab ua raws li hauv qab no

pip nruab sej-rpi.gpio python3-rpi.gpio

Nrog lub tsev qiv ntawv teeb tsa tam sim no qhib qhov koj nyiam Python IDE thiab muab cov lej no lossis sim koj tus kheej

Kauj Ruam 2: Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog:-

Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog
Koj Yuav Tsum Txhim Kho Qee Qhov Ntxiv rau Nws Lawv Yog

pib install bs4

pip nruab tabulate

pip nruab matplotlib

pip nruab numpy

koj yuav tsum qhib qhov hais kom sai, mus rau khawm tshawb nrhiav thiab sau cmd thiab qhib nrog Run as administrator

Kauj ruam 3: Ntshuam Libaray

Importing Libaray
Importing Libaray

# importing cov tsev qiv ntawv

ntshuam thov

los ntawm bs4 ntshuam BeautifulSoup

los ntawm tabulate ntshuam tabulate

import os

import numpy as np

ntshuam matplotlib.pyplot li plt

Kauj Ruam 4: Sau Cov Ntaub Ntawv Nyob Los Ntawm Ministry of Health Affairs Official Lub Vev Xaib

Sau Cov Ntaub Ntawv Nyob Los Ntawm Ministry of Health Affairs Official Lub Vev Xaib
Sau Cov Ntaub Ntawv Nyob Los Ntawm Ministry of Health Affairs Official Lub Vev Xaib

extract_contents = lambda row: [x.text.replace ('\ n', '') rau x uake]

URL = 'https://www.mohfw.gov.in/' SHORT_HEADERS = ['SNo', 'State', 'Indian-Confirmed', 'Foreign-Confirmed', 'Cured', 'Death']

teb = thov.get (URL).cov ntsiab lus kua zaub = BeautifulSoup (teb, 'html.parser')

header = extract_contents (soup.tr.find_all ('th'))

stats = all_rows = soup.find_all ('tr')

rau kab hauv tag nrho _rows:

stat = extract_contents (row.find_all ('td')) cov

yog stat:

yog len (stat) == 5:

# kab kawg

stat = ['', *xwm]

stats.append (xwm txheej)

elif len (stat) == 6:

stats.append (xwm txheej)

stats [-1] [1] = "Tag Nrho Cov Neeg"

stats.remove (stats [-1])

Kauj Ruam 5: Tsim Cov Lus los Qhia Qhov Tawm

Tsim Cov Lus los Qhia Qhov Tawm
Tsim Cov Lus los Qhia Qhov Tawm
Tsim Cov Lus los Qhia Qhov Tawm
Tsim Cov Lus los Qhia Qhov Tawm
Tsim Cov Lus los Qhia Qhov Tawm
Tsim Cov Lus los Qhia Qhov Tawm

khoom =

rau kab hauv stats: objects.append (kab [1])

y_pos = np.arange (len (object))

kev ua tau zoo =

rau kab hauv stats:

performance.append (int (kab [2]) + int (kab [3]))

table = tabulate (stats, headers = SHORT_HEADERS)

luam tawm (rooj)

Kauj Ruam 6: Tam sim no koj tuaj yeem pom Daim Ntawv Tshaj Qhia no

Tam sim no koj tuaj yeem pom Daim Ntawv Tshaj Qhia no
Tam sim no koj tuaj yeem pom Daim Ntawv Tshaj Qhia no

Nco ntsoov nws yog daim ntawv qhia nyob yog li muaj kev hloov pauv txhua lub sijhawm

Pom zoo: