Python Exercise: Visualize Worldwide Confirmed Novel Coronavirus cases over time
Python Project: COVID-19 Exercise-14 with Solution
Write a Python program to visualize Worldwide Confirmed Novel Coronavirus (COVID-19) cases over time.
Sample Solution:
Python Code:
import pandas as pd
import plotly.express as px
import plotly.io as pio
pio.templates.default ="plotly_dark"
covid_data= pd.read_csv('https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_daily_reports/03-19-2020.csv')
grouped = covid_data.groupby('Last Update')['Last Update', 'Confirmed', 'Deaths'].sum().reset_index()
fig = px.line(grouped, x="Last Update", y="Confirmed",
title="Worldwide Confirmed Novel Coronavirus(COVID-19) Cases Over Time")
fig.show()
Jupyter Notebook:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Download the above Notebook from here.
What is the difficulty level of this exercise?
Python: Tips of the Day
Returns True if the provided function returns True for at least one element in the list, False otherwise
Example:
def some(lst, fn=lambda x: x): return any(map(fn, lst)) print(some([0, 1, 2, 0], lambda x: x >= 2 )) print(some([0, 0, 1, 0]))
Output:
True True
- New Content published on w3resource:
- Scala Programming Exercises, Practice, Solution
- Python Itertools exercises
- Python Numpy exercises
- Python GeoPy Package exercises
- Python Pandas exercises
- Python nltk exercises
- Python BeautifulSoup exercises
- Form Template
- Composer - PHP Package Manager
- PHPUnit - PHP Testing
- Laravel - PHP Framework
- Angular - JavaScript Framework
- React - JavaScript Library
- Vue - JavaScript Framework
- Jest - JavaScript Testing Framework