0% found this document useful (0 votes)
9 views11 pages

Covid 19 Analysis and Visualization Using Plotly Express

The document outlines data analysis and manipulation using Python libraries such as Plotly and Pandas, focusing on COVID-19 datasets. It describes two datasets: 'dataset1' with 209 rows and 17 columns, and 'dataset2' with 35,156 rows and multiple fields related to COVID-19 statistics. The document includes information on data types, unique values, and sample data for each column in the datasets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views11 pages

Covid 19 Analysis and Visualization Using Plotly Express

The document outlines data analysis and manipulation using Python libraries such as Plotly and Pandas, focusing on COVID-19 datasets. It describes two datasets: 'dataset1' with 209 rows and 17 columns, and 'dataset2' with 35,156 rows and multiple fields related to COVID-19 statistics. The document includes information on data types, unique values, and sample data for each column in the datasets.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 11

# Data analysis and Manipulation

import plotly.graph_objs as go
import plotly.io as pio
import plotly.express as px
import pandas as pd

# Data Visualization
import matplotlib.pyplot as plt

# Importing Plotly
import plotly.offline as py
py.init_notebook_mode(connected=True)

# Initializing Plotly
pio.renderers.default = 'colab'

# Importing Dataset1
dataset1 = pd.read_csv("covid.csv")
dataset1.head() # returns first 5 rows

{"summary":"{\n \"name\": \"dataset1\",\n \"rows\": 209,\n


\"fields\": [\n {\n \"column\": \"Country/Region\",\n
\"properties\": {\n \"dtype\": \"string\",\n
\"num_unique_values\": 209,\n \"samples\": [\n
\"Oman\",\n \"Martinique\",\n \"French Guiana\"\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"Continent\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 6,\n \"samples\": [\n \"North
America\",\n \"South America\",\n
\"Australia/Oceania\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Population\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 104766099.48117349,\n \"min\":
801.0,\n \"max\": 1381344997.0,\n \"num_unique_values\":
208,\n \"samples\": [\n 23821199.0,\n
60452568.0,\n 5794279.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"TotalCases\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
432586,\n \"min\": 10,\n \"max\": 5032179,\n
\"num_unique_values\": 206,\n \"samples\": [\n
249204,\n 354530,\n 17\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"NewCases\",\n \"properties\":
{\n \"dtype\": \"number\",\n \"std\":
3129.611424229319,\n \"min\": 20.0,\n \"max\": 6590.0,\n
\"num_unique_values\": 4,\n \"samples\": [\n 1282.0,\n
30.0,\n 6590.0\n ],\n \"semantic_type\": \"\",\
n \"description\": \"\"\n }\n },\n {\n
\"column\": \"TotalDeaths\",\n \"properties\": {\n
\"dtype\": \"number\",\n \"std\": 15487.184877168185,\n
\"min\": 1.0,\n \"max\": 162804.0,\n
\"num_unique_values\": 150,\n \"samples\": [\n 617.0,\
n 9252.0,\n 5.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"NewDeaths\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
451.1995124110841,\n \"min\": 1.0,\n \"max\": 819.0,\n
\"num_unique_values\": 3,\n \"samples\": [\n 819.0,\n
80.0,\n 1.0\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"TotalRecovered\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 256698.40689838002,\n \"min\":
7.0,\n \"max\": 2576668.0,\n \"num_unique_values\":
201,\n \"samples\": [\n 652.0,\n 99852.0,\n
40539.0\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"NewRecovered\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 2154.779803135346,\n \"min\":
42.0,\n \"max\": 4140.0,\n \"num_unique_values\": 3,\n
\"samples\": [\n 4140.0,\n 936.0,\n 42.0\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"ActiveCases\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
174632.7369279219,\n \"min\": 0.0,\n \"max\":
2292707.0,\n \"num_unique_values\": 180,\n \"samples\":
[\n 50473.0,\n 37559.0,\n 17.0\n ],\
n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"Serious,Critical\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
2047.5186133519667,\n \"min\": 1.0,\n \"max\": 18296.0,\
n \"num_unique_values\": 74,\n \"samples\": [\n
539.0,\n 11.0,\n 384.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Tot Cases/1M pop\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
5191.986456701242,\n \"min\": 3.0,\n \"max\": 39922.0,\n
\"num_unique_values\": 202,\n \"samples\": [\n
1317.0,\n 4122.0,\n 15769.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Deaths/1M pop\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
174.9568620893644,\n \"min\": 0.08,\n \"max\": 1238.0,\n
\"num_unique_values\": 107,\n \"samples\": [\n 38.0,\n
214.0,\n 162.0\n ],\n \"semantic_type\": \"\",\
n \"description\": \"\"\n }\n },\n {\n
\"column\": \"TotalTests\",\n \"properties\": {\n
\"dtype\": \"number\",\n \"std\": 5553366.67043168,\n
\"min\": 61.0,\n \"max\": 63139605.0,\n
\"num_unique_values\": 190,\n \"samples\": [\n
1183.0,\n 4238.0,\n 29233.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Tests/1M pop\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
152730.59123995784,\n \"min\": 4.0,\n \"max\":
995282.0,\n \"num_unique_values\": 190,\n \"samples\":
[\n 22050.0,\n 3209.0,\n 11485.0\
n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\": \"WHO
Region\",\n \"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 6,\n \"samples\": [\n
\"Americas\",\n \"South-EastAsia\",\n
\"WesternPacific\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"iso_alpha\",\n \"properties\": {\n \"dtype\":
\"string\",\n \"num_unique_values\": 193,\n \"samples\":
[\n \"HND\",\n \"TGO\",\n \"MKD\"\
n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n }\n ]\
n}","type":"dataframe","variable_name":"dataset1"}

# Returns tuple of shape (Rows, columns)


print(dataset1.shape)

# Returns size of dataframe


print(dataset1.size)

(209, 17)
3553

# Information about Dataset1


# return concise summary of dataframe
dataset1.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 209 entries, 0 to 208
Data columns (total 17 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Country/Region 209 non-null object
1 Continent 208 non-null object
2 Population 208 non-null float64
3 TotalCases 209 non-null int64
4 NewCases 4 non-null float64
5 TotalDeaths 188 non-null float64
6 NewDeaths 3 non-null float64
7 TotalRecovered 205 non-null float64
8 NewRecovered 3 non-null float64
9 ActiveCases 205 non-null float64
10 Serious,Critical 122 non-null float64
11 Tot Cases/1M pop 208 non-null float64
12 Deaths/1M pop 187 non-null float64
13 TotalTests 191 non-null float64
14 Tests/1M pop 191 non-null float64
15 WHO Region 184 non-null object
16 iso_alpha 209 non-null object
dtypes: float64(12), int64(1), object(4)
memory usage: 27.9+ KB

# Importing Dataset2
dataset2 = pd.read_csv("covid_grouped.csv")
dataset2.head() # return first 5 rows of dataset2

{"summary":"{\n \"name\": \"dataset2\",\n \"rows\": 35156,\n


\"fields\": [\n {\n \"column\": \"Date\",\n
\"properties\": {\n \"dtype\": \"object\",\n
\"num_unique_values\": 188,\n \"samples\": [\n \"2020-
07-23\",\n \"2020-07-02\",\n \"2020-02-09\"\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"Country/Region\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 187,\n \"samples\": [\n
\"Zambia\",\n \"Iceland\",\n \"Eritrea\"\
n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Confirmed\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 149981,\n \"min\": 0,\n
\"max\": 4290259,\n \"num_unique_values\": 10732,\n
\"samples\": [\n 2913,\n 29767,\n 169425\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"Deaths\",\n \"properties\":
{\n \"dtype\": \"number\",\n \"std\": 7437,\n
\"min\": 0,\n \"max\": 148011,\n \"num_unique_values\":
3598,\n \"samples\": [\n 6679,\n 312,\n
34854\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Recovered\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 64546,\n \"min\": 0,\n
\"max\": 1846641,\n \"num_unique_values\": 7649,\n
\"samples\": [\n 5223,\n 67309,\n 1303\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"Active\",\n \"properties\":
{\n \"dtype\": \"number\",\n \"std\": 89971,\n
\"min\": -2,\n \"max\": 2816444,\n
\"num_unique_values\": 8440,\n \"samples\": [\n 441,\n
46057,\n 1706\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\": \"New
cases\",\n \"properties\": {\n \"dtype\": \"number\",\n
\"std\": 3005,\n \"min\": 0,\n \"max\": 77255,\n
\"num_unique_values\": 2800,\n \"samples\": [\n 1496,\
n 1684,\n 4288\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"New deaths\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
115,\n \"min\": -1918,\n \"max\": 3887,\n
\"num_unique_values\": 715,\n \"samples\": [\n 839,\n
587,\n 35\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\": \"New
recovered\",\n \"properties\": {\n \"dtype\": \"number\",\
n \"std\": 2068,\n \"min\": -16298,\n \"max\":
140050,\n \"num_unique_values\": 2276,\n \"samples\": [\
n 26784,\n 1629,\n 2390\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"WHO Region\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 6,\n \"samples\": [\n \"Eastern
Mediterranean\",\n \"Europe\",\n \"South-East
Asia\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"iso_alpha\",\n \"properties\": {\n \"dtype\":
\"category\",\n \"num_unique_values\": 179,\n
\"samples\": [\n \"IDN\",\n \"BEL\",\n
\"GRC\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n }\n ]\
n}","type":"dataframe","variable_name":"dataset2"}

# Returns tuple of shape (Rows, columns)


print(dataset2.shape)

# Returns size of dataframe


print(dataset2.size)

(35156, 11)
386716

# Information about Dataset2


dataset2.info() # return concise summary of dataframe

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 35156 entries, 0 to 35155
Data columns (total 11 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Date 35156 non-null object
1 Country/Region 35156 non-null object
2 Confirmed 35156 non-null int64
3 Deaths 35156 non-null int64
4 Recovered 35156 non-null int64
5 Active 35156 non-null int64
6 New cases 35156 non-null int64
7 New deaths 35156 non-null int64
8 New recovered 35156 non-null int64
9 WHO Region 35156 non-null object
10 iso_alpha 35156 non-null object
dtypes: int64(7), object(4)
memory usage: 3.0+ MB

# Columns labels of a Dataset1


dataset1.columns

Index(['Country/Region', 'Continent', 'Population', 'TotalCases',


'NewCases',
'TotalDeaths', 'NewDeaths', 'TotalRecovered', 'NewRecovered',
'ActiveCases', 'Serious,Critical', 'Tot Cases/1M pop',
'Deaths/1M pop',
'TotalTests', 'Tests/1M pop', 'WHO Region', 'iso_alpha'],
dtype='object')

# Drop NewCases, NewDeaths, NewRecovered rows from dataset1

dataset1.drop(['NewCases', 'NewDeaths', 'NewRecovered'],


axis=1, inplace=True)

# Select random set of values from dataset1


dataset1.sample(5)

{"summary":"{\n \"name\": \"dataset1\",\n \"rows\": 5,\n


\"fields\": [\n {\n \"column\": \"Country/Region\",\n
\"properties\": {\n \"dtype\": \"string\",\n
\"num_unique_values\": 5,\n \"samples\": [\n
\"Monaco\",\n \"Cambodia\",\n \"UK\"\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Continent\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 2,\n \"samples\": [\n
\"Europe\",\n \"Asia\"\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Population\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
112103852.12999673,\n \"min\": 39270.0,\n \"max\":
273808365.0,\n \"num_unique_values\": 5,\n \"samples\":
[\n 39270.0,\n 16741375.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"TotalCases\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
364585,\n \"min\": 125,\n \"max\": 871894,\n
\"num_unique_values\": 5,\n \"samples\": [\n 125,\n
243\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"TotalDeaths\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 20744.13393387795,\n \"min\":
4.0,\n \"max\": 46413.0,\n \"num_unique_values\": 4,\n
\"samples\": [\n 4.0,\n 14606.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"TotalRecovered\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
327457.78123637557,\n \"min\": 105.0,\n \"max\":
676357.0,\n \"num_unique_values\": 4,\n \"samples\": [\n
105.0,\n 210.0\n ],\n \"semantic_type\": \"\",\
n \"description\": \"\"\n }\n },\n {\n
\"column\": \"ActiveCases\",\n \"properties\": {\n
\"dtype\": \"number\",\n \"std\": 86034.73581980323,\n
\"min\": 16.0,\n \"max\": 180931.0,\n
\"num_unique_values\": 4,\n \"samples\": [\n 16.0,\n
33.0\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Serious,Critical\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 1137.8327352178496,\n \"min\":
1.0,\n \"max\": 2300.0,\n \"num_unique_values\": 4,\n
\"samples\": [\n 73.0,\n 1.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Tot Cases/1M pop\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
2578.188569519305,\n \"min\": 15.0,\n \"max\": 5974.0,\n
\"num_unique_values\": 5,\n \"samples\": [\n 3183.0,\n
15.0\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Deaths/1M pop\",\n \"properties\": {\n \"dtype\":
\"number\",\n \"std\": 306.88583653643366,\n \"min\":
20.0,\n \"max\": 683.0,\n \"num_unique_values\": 4,\n
\"samples\": [\n 102.0,\n 100.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"TotalTests\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
13350218.542872969,\n \"min\": 38209.0,\n \"max\":
29716907.0,\n \"num_unique_values\": 5,\n \"samples\":
[\n 38209.0,\n 67807.0\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Tests/1M pop\",\n
\"properties\": {\n \"dtype\": \"number\",\n \"std\":
399185.0325654758,\n \"min\": 4050.0,\n \"max\":
972982.0,\n \"num_unique_values\": 5,\n \"samples\": [\n
972982.0,\n 4050.0\n ],\n \"semantic_type\":
\"\",\n \"description\": \"\"\n }\n },\n {\n
\"column\": \"WHO Region\",\n \"properties\": {\n
\"dtype\": \"string\",\n \"num_unique_values\": 3,\n
\"samples\": [\n \"South-EastAsia\",\n \"Europe\"\n
],\n \"semantic_type\": \"\",\n \"description\": \"\"\n
}\n },\n {\n \"column\": \"iso_alpha\",\n
\"properties\": {\n \"dtype\": \"string\",\n
\"num_unique_values\": 5,\n \"samples\": [\n \"MCO\",\
n \"KHM\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n }\n ]\n}","type":"dataframe"}

# Import create_table Figure Factory

from plotly.figure_factory import create_table

colorscale = [[0, '#4d004c'], [.5, '#f2e5ff'], [1, '#ffffff']]


table = create_table(dataset1.head(15), colorscale=colorscale)
py.iplot(table)

px.bar(dataset1.head(15), x = 'Country/Region',
y = 'TotalCases',color = 'TotalCases',
height = 500,hover_data = ['Country/Region', 'Continent'])

px.bar(dataset1.head(15), x = 'Country/Region', y = 'TotalCases',


color = 'TotalDeaths', height = 500,
hover_data = ['Country/Region', 'Continent'])

px.bar(dataset1.head(15), x = 'Country/Region', y = 'TotalCases',


color = 'TotalDeaths', height = 500,
hover_data = ['Country/Region', 'Continent'])

px.bar(dataset1.head(15), x = 'Country/Region', y = 'TotalCases',


color = 'TotalTests', height = 500, hover_data =
['Country/Region', 'Continent'])

px.bar(dataset1.head(15), x = 'TotalTests', y = 'Country/Region',


color = 'TotalTests',orientation ='h', height = 500,
hover_data = ['Country/Region', 'Continent'])

px.bar(dataset1.head(15), x = 'TotalTests', y = 'Continent',


color = 'TotalTests',orientation ='h', height = 500,
hover_data = ['Country/Region', 'Continent'])

px.scatter(dataset1, x='Continent',y='TotalCases',
hover_data=['Country/Region', 'Continent'],
color='TotalCases', size='TotalCases', size_max=80)

px.scatter(dataset1.head(54), x='Continent',y='TotalTests',
hover_data=['Country/Region', 'Continent'],
color='TotalTests', size='TotalTests', size_max=80)

px.scatter(dataset1.head(50), x='Continent',y='TotalTests',
hover_data=['Country/Region', 'Continent'],
color='TotalTests', size='TotalTests', size_max=80,
log_y=True)
px.scatter(dataset1.head(10), x='Country/Region', y= 'TotalDeaths',
hover_data=['Country/Region', 'Continent'],
color='Country/Region', size= 'TotalDeaths', size_max=80)

px.scatter(dataset1.head(30), x='Country/Region', y= 'Tests/1M pop',


hover_data=['Country/Region', 'Continent'],
color='Country/Region', size= 'Tests/1M pop', size_max=80)

px.scatter(dataset1.head(30), x='Country/Region', y= 'Tests/1M pop',


hover_data=['Country/Region', 'Continent'],
color='Tests/1M pop', size= 'Tests/1M pop', size_max=80)

px.scatter(dataset1.head(30), x='TotalCases', y= 'TotalDeaths',


hover_data=['Country/Region', 'Continent'],
color='TotalDeaths', size= 'TotalDeaths', size_max=80)

px.scatter(dataset1.head(30), x='TotalCases', y= 'TotalDeaths',


hover_data=['Country/Region', 'Continent'],
color='TotalDeaths', size= 'TotalDeaths', size_max=80,
log_x=True, log_y=True)

px.scatter(dataset1.head(30), x='TotalTests', y= 'TotalCases',


hover_data=['Country/Region', 'Continent'],
color='TotalTests', size= 'TotalTests', size_max=80,
log_x=True, log_y=True)

px.bar(df_US, x="Date", y="Confirmed", color="Confirmed", height=400)

px.bar(df_US,x="Date", y="Recovered", color="Recovered", height=400)

px.line(df_US,x="Date", y="Recovered", height=400)

px.line(df_US,x="Date", y="Deaths", height=400)

px.line(df_US,x="Date", y="Confirmed", height=400)

px.line(df_US,x="Date", y="New cases", height=400)

px.bar(df_US,x="Date", y="New cases", height=400)

px.scatter(df_US, x="Confirmed", y="Deaths", height=400)

px.choropleth(dataset2,
locations="iso_alpha",
color="Confirmed",
hover_name="Country/Region",
color_continuous_scale="Blues",
animation_frame="Date")

px.choropleth(dataset2,
locations='iso_alpha',
color="Deaths",
hover_name="Country/Region",
color_continuous_scale="Viridis",
animation_frame="Date" )

px.choropleth(dataset2,
locations='iso_alpha',
color="Recovered",
hover_name="Country/Region",
color_continuous_scale="RdYlGn",
projection="natural earth",
animation_frame="Date" )

px.bar(dataset2, x="WHO Region", y="Confirmed", color="WHO Region",


animation_frame="Date", hover_name="Country/Region")

dataset3= pd.read_csv("coviddeath.csv")
dataset3.head()

{"summary":"{\n \"name\": \"dataset3\",\n \"rows\": 12260,\n


\"fields\": [\n {\n \"column\": \"Data as of\",\n
\"properties\": {\n \"dtype\": \"object\",\n
\"num_unique_values\": 1,\n \"samples\": [\n
\"08/30/2020\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Start Week\",\n \"properties\": {\n \"dtype\":
\"object\",\n \"num_unique_values\": 1,\n \"samples\":
[\n \"02/01/2020\"\n ],\n \"semantic_type\":
\"\",\n \"description\": \"\"\n }\n },\n {\n
\"column\": \"End Week\",\n \"properties\": {\n \"dtype\":
\"object\",\n \"num_unique_values\": 1,\n \"samples\":
[\n \"08/29/2020\"\n ],\n \"semantic_type\":
\"\",\n \"description\": \"\"\n }\n },\n {\n
\"column\": \"State\",\n \"properties\": {\n \"dtype\":
\"category\",\n \"num_unique_values\": 54,\n
\"samples\": [\n \"LA\"\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Condition Group\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 12,\n \"samples\": [\n \"All
other conditions and causes (residual)\"\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Condition\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 23,\n \"samples\": [\n
\"Diabetes\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"ICD10_codes\",\n \"properties\": {\n \"dtype\":
\"category\",\n \"num_unique_values\": 23,\n
\"samples\": [\n \"E10-E14\"\n ],\n
\"semantic_type\": \"\",\n \"description\": \"\"\n }\
n },\n {\n \"column\": \"Age Group\",\n
\"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 10,\n \"samples\": [\n \"Not
stated\"\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Number of COVID-19 Deaths\",\n \"properties\": {\n
\"dtype\": \"number\",\n \"std\": 3411.6853195964054,\n
\"min\": 0.0,\n \"max\": 169044.0,\n
\"num_unique_values\": 1022,\n \"samples\": [\n
5915.0\n ],\n \"semantic_type\": \"\",\n
\"description\": \"\"\n }\n },\n {\n \"column\":
\"Flag\",\n \"properties\": {\n \"dtype\": \"category\",\n
\"num_unique_values\": 1,\n \"samples\": [\n \"Counts
less than 10 suppressed.\"\n ],\n \"semantic_type\":
\"\",\n \"description\": \"\"\n }\n }\n ]\
n}","type":"dataframe","variable_name":"dataset3"}

dataset3.tail()

{"repr_error":"0","type":"dataframe"}

You might also like