Corona Virus Live Updates for India - Using Python Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report As we know the whole world is being affected by the COVID-19 pandemic and almost everyone is working from home. We all should utilize this duration at best, to improve our technical skills or writing some good Pythonic scripts. Let's see a simple Python script to demonstrate the state-wise coronavirus cases in India. This Python script fetches the live data from the Ministry of Health Affairs Official Website. Then data is represented in the horizontal bar graph.To run this script follow the below installation - $ pip install bs4 $ pip install tabulate $ pip install matplotlib $ pip install numpy $ pip install requests Let's try to execute the script step-by-step. Step #1: Python3 # importing libraries import requests from bs4 import BeautifulSoup from tabulate import tabulate import os import numpy as np import matplotlib.pyplot as plt Step #2: Python3 extract_contents = lambda row: [x.text.replace('\n', '') for x in row] URL = 'https://www.mohfw.gov.in/' SHORT_HEADERS = ['SNo', 'State','Indian-Confirmed(Including Foreign Confirmed)','Cured','Death'] response = requests.get(URL).content soup = BeautifulSoup(response, 'html.parser') header = extract_contents(soup.tr.find_all('th')) stats = [] all_rows = soup.find_all('tr') for row in all_rows: stat = extract_contents(row.find_all('td')) if stat: if len(stat) == 4: # last row stat = ['', *stat] stats.append(stat) elif len(stat) == 5: stats.append(stat) stats[-1][0] = len(stats) stats[-1][1] = "Total Cases" Step #3: Python3 objects = [] for row in stats : objects.append(row[1]) y_pos = np.arange(len(objects)) performance = [] for row in stats[:len(stats)-1] : performance.append(int(row[2])) performance.append(int(stats[-1][2][:len(stats[-1][2])-1])) table = tabulate(stats, headers=SHORT_HEADERS) print(table) Output: Step #4: Python3 plt.barh(y_pos, performance, align='center', alpha=0.5, color=(234/256.0, 128/256.0, 252/256.0), edgecolor=(106/256.0, 27/256.0, 154/256.0)) plt.yticks(y_pos, objects) plt.xlim(1,performance[-1]+1000) plt.xlabel('Number of Cases') plt.title('Corona Virus Cases') plt.show() Output: Comment More infoAdvertise with us Next Article Corona Virus Live Updates for India - Using Python _decryptor_ Follow Improve Article Tags : Machine Learning python-utility python Python-projects Practice Tags : Machine Learningpython Similar Reads Application to get live USD/INR rate Using Python In this article, we are going to write a python scripts to get live information of USD/INR rate and bind with it GUI application. Modules Required:bs4: Beautiful Soup is a Python library for pulling data out of HTML and XML files. Installation: pip install bs4requests: This module allows you to send 3 min read How to get COVID 19 update using Covid module in Python? A new Python library which tells the COVID-19 related information (country-wise) and it show that how many cases of confirmed, active, deaths, recovered found in that particular Country. Requirement: You have python package named COVID and python >= 3.6 Installation: pip install covid Dependencie 3 min read Send SMS updates to mobile phone using python If you are running any python script and want to send regular updates from your script to your mobile phone through SMS, you can use SinchSMS API to send SMS.Approach : Create an app on Sinch and get the key and secret of the app and use these credentials in the following script to send SMS to your 2 min read GUI Application for Live Cricket scoreboard Using Python In this article, we will see how sports.py module is imported and implemented to produce scoreboard of a specified sport like baseball, basketball, cricket and many more along with other details about the sport. Code examples in the text below revolve around cricket, you can perform the same operati 3 min read Track Covid-19 Vaccine Slots using cowin in Python India has recently launched its largest Vaccination drive for everyone to get vaccinated against covid-19. The CoWin is an official website that handles the availability of the vacant slot. The process of going forth can be tedious items. Python API Wrapper for this site, CoWin, offers certain metho 3 min read Like