Seaborn Project – Covid-19 Case Analysis

Machine Learning courses with 100+ Real-time projects Start Now!!

Program 1

Covid Dataset

#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()

 

We work very hard to provide you quality material
Could you take 15 seconds and share your happy experience on Google

courses

DataFlair Team

DataFlair Team provides high-impact content on programming, Java, Python, C++, DSA, AI, ML, data Science, Android, Flutter, MERN, Web Development, and technology. We make complex concepts easy to grasp, helping learners of all levels succeed in their tech careers.

Leave a Reply

Your email address will not be published. Required fields are marked *