Seaborn Project – Covid-19 Case Analysis
Machine Learning courses with 100+ Real-time projects Start Now!!
Program 1
#COVID-19 Cases Analysis Using Seaborn
# Project shows informative line chart and HeatMap chart
# showing the growth of confirmed COVID-19 cases over time for Italy, US, India, and Brazil.
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
# Load dataset
df = pd.read_csv("covid_data.csv")
#print(df)
print(df.isnull().sum())
# Convert 'Date' column to datetime
df['Date'] = pd.to_datetime(df['Date'])
# Optional: Filter data for selected countries
countries = ['Italy', 'US', 'India', 'Brazil']
df_filtered = df[df['Country'].isin(countries)]
#Plot 1: Lineplot of confirmed cases over time
# plt.figure(figsize=(12, 6))
# sns.lineplot(data=df_filtered, x='Date', y='Confirmed', hue='Country',style='Country')
# plt.title("Confirmed COVID-19 Cases Over Time")
# plt.ylabel("Confirmed Cases")
# plt.xlabel("Date")
# plt.show()
# Plot 2: Deaths over time
# plt.figure(figsize=(12, 6))
# sns.lineplot(data=df_filtered, x='Date', y='Deaths', hue='Country', palette="rocket")
# plt.title("COVID-19 Deaths Over Time")
# plt.ylabel("Deaths")
# plt.xlabel("Date")
# plt.show()
# Plot 3: Heatmap of total cases per country
# df_latest = df_filtered[df_filtered['Date'] == df_filtered['Date'].max()]
# df_latest = df_latest.set_index('Country')[['Confirmed', 'Deaths', 'Recovered']]
# plt.figure(figsize=(8, 4))
# sns.heatmap(df_latest, annot=True, fmt="d", cmap="coolwarm")
# plt.title("Latest COVID-19 Stats by Country")
# plt.show()
Did you know we work 24x7 to provide you best tutorials
Please encourage us - write a review on Google

