Analysis of COVID-19 pandemic in INDIA

What is Corona Virus(COVID-19)?

Coronavirus is a family of viruses that can cause illness varying from common cold and cough to sometimes more severe disease. SARS- CoV-2 (n-coronavirus) is the new virus of the coronavirus family, which was first discovered in 2019 and has not been identified in humans before. It is a contiguous virus which started from Wuhan in December 2019 and later, it was declared as a Pandemic by WHO due to high rate spreads throughout the world. As the Pandemic is spreading all over the world; it is important to understand about this spread. This Notebook is an effort to analyze the cumulative data of confirmed cases, deaths, and recovered cases over time. In this notebook, the focus is to analyze the trend of this virus all over India.

History of COVID-19 in India

India reported its first case of COVID-19 in Kerala on January 30, which rose to three cases by February 3; These were students who had returned from Wuhan, China. No significant rise in cases was seen in the rest of February. India observed a 14-hour voluntary public curfew at the instance of the prime minister Narendra Modi on 22 March 2020. The government followed it up with lockdowns in 75 districts where COVID cases had occurred as well as all major cities. Further, on 24 th March, the prime minister ordered a nationwide lockdown for 21 days that affected the entire 1.3 billion population of India. The transmission increased rapidly during March, after several cases were reported all over the country, most of which were linked to people with a travel history to affected countries. On 12 th March, a 76-year-old man who had returned from Saudi Arabia became the first victim of the virus in the country. On 4 th March, 22 new cases came to light, including those of an Italian tourist group with 14 infected members. But number of cases increased dramatically after 19 th March. Experts suggest the number of infections might be much higher as India's testing rates are among the lowest in the world. The infection rate of COVID-19 in India is reported to be 1.7, significantly lower than in the worst affected countries.

from IPython.display import * 
Image("https://media.foxbusiness.com/BrightCove/854081161001/202003/2652/854081161001_6141155653001_6141149610001-vs.jpg")

Data collection and preprocessing

import warnings
warnings.filterwarnings("ignore")
!pip install --upgrade plotly
import json
token = {"username":"abshkpskr","key":"7bf37d08aafdc81ecb2640a1960fddbc"}
with open('kaggle.json', 'w') as file:
    json.dump(token, file)

!mkdir ~/.kaggle
!cp kaggle.json ~/.kaggle/
!chmod 600 ~/.kaggle/kaggle.json
!kaggle datasets download -d imdevskp/covid19-corona-virus-india-dataset
from zipfile import ZipFile
ZipFile('covid19-corona-virus-india-dataset.zip').extractall()

import os
for i in sorted(os.listdir()):
    print(i)
#libraries for data management
import numpy as np
import pandas as pd

#libraries for visualization
import matplotlib.pyplot as plt
import seaborn as sns
import plotly
import plotly.express as px
import plotly.graph_objs as go
import folium 

from google.colab import files
from IPython.display import *

# plotly.io.renderers.default = 'colab'
plotly.offline.init_notebook_mode(connected=True)
data = pd.read_csv('complete.csv')
district_data = pd.read_csv('district_level_latest.csv')
state_data = pd.read_csv('state_level_latest.csv')
nation_data = pd.read_csv('nation_level_daily.csv')

patients_data = pd.read_csv('patients_data.csv')

tests_data = pd.read_csv('tests_day_wise.csv')
state_tests_data = pd.read_csv('tests_state_wise.csv')

zones = pd.read_csv('https://raw.githubusercontent.com/AbshkPskr/Covid-19-Analysis/master/India%20Covid%20Zones.csv')
data
Date Name of State / UT Latitude Longitude Total Confirmed cases Death Cured/Discharged/Migrated New cases New deaths New recovered
0 2020-01-30 Kerala 10.8505 76.2711 1 0 0 0 0 0
1 2020-01-31 Kerala 10.8505 76.2711 1 0 0 0 0 0
2 2020-02-01 Kerala 10.8505 76.2711 2 0 0 1 0 0
3 2020-02-02 Kerala 10.8505 76.2711 3 0 0 1 0 0
4 2020-02-03 Kerala 10.8505 76.2711 3 0 0 0 0 0
... ... ... ... ... ... ... ... ... ... ...
3715 2020-07-09 Telangana 18.1124 79.0193 29536 324 17279 1924 11 992
3716 2020-07-09 Tripura 23.9408 91.9882 1761 1 1324 57 0 76
3717 2020-07-09 Uttar Pradesh 26.8467 80.9462 31156 845 20331 1188 18 704
3718 2020-07-09 Uttarakhand 30.0668 79.0193 3258 46 2650 28 3 29
3719 2020-07-09 West Bengal 22.9868 87.8550 24823 827 16291 986 23 501

3720 rows × 10 columns

data = data.drop(['New cases','New deaths','New recovered'],axis = 1)
data.columns = ['date','state','lat','long','confirmed','deaths','recovered']
data = data[['lat','long','state','date','confirmed','deaths','recovered']]

data.loc[(data['state'] == 'Union Territory of Ladakh'),'state'] = 'Ladakh'
data.loc[(data['state'] == 'Union Territory of Jammu and Kashmir'),'state'] = 'Jammu and Kashmir'
data.loc[(data['state'] == 'Telengana'),'state'] = 'Telangana'
data.loc[(data['state'] == 'Odisha'),'state'] = 'Orissa'
data.loc[(data['state'] == 'Union Territory of Chandigarh'),'state'] = 'Chandigarh'
bing_data = pd.read_csv('https://raw.githubusercontent.com/microsoft/Bing-COVID-19-Data/master/data/Bing-COVID19-Data.csv',index_col = 'ID')
bing_data = bing_data[(bing_data['Country_Region'] == 'India')]# & (bing_data['Latitude'] != 22.49312) & (bing_data['Longitude'] != 79.72701)]
bing_data = bing_data.drop(['ISO2','ISO3','Country_Region'],axis = 1)
bing_data.columns = ['date','confirmed','new_confirmed','deaths','new_deaths','recovered','new_recovered','lat','long','state','city']
bing_data['active'] = bing_data['confirmed'] - (bing_data['deaths'] + bing_data['recovered'])
bing_data = bing_data[(bing_data['state'] == 'Chandigarh') | 
                      (bing_data['state'] == 'Andaman and Nicobar Islands') |
                      (bing_data['city'].notna())]
# bing_data = bing_data[(bing_data['city'].isna())]
bing_data['city'] = bing_data['city'].replace(np.nan,"(Union Territory)")
bing_data = bing_data.replace(np.nan,0)
case_data = pd.DataFrame()

states = data['state'].unique()

for state in states:
    temp = data[(data['state'] == state)]
    temp1 = pd.DataFrame()
    temp1  = temp1.append(temp.iloc[0:1,:],ignore_index=True)
    temp1['new_confirmed'] = temp1['confirmed']
    temp1['new_deaths'] = temp1['deaths']
    temp1['new_recovered'] = temp1['recovered']
    for i in range(1,len(temp)):
        lat,lon,state,date,confirmed,death,recovered = temp.iloc[i].values
        new_confirmed = temp.iloc[i,4] - temp.iloc[i-1,4]
        new_deaths = temp.iloc[i,5] - temp.iloc[i-1,5]
        new_recovered = temp.iloc[i,6] - temp.iloc[i-1,6]
        if new_confirmed < 0:
            confirmed = temp.iloc[i-1][4]
            new_confirmed = 0
        if new_deaths < 0:
            deaths = temp.iloc[i-1][5]
            new_deaths = 0
        if new_recovered < 0:
            recovered = temp.iloc[i-1][6]
            new_recovered = 0
        temp1.loc[i] = [lat,lon,state,date,confirmed,death,recovered,new_confirmed,new_deaths,new_recovered]
    case_data = pd.concat([case_data,temp1],ignore_index=True)

#case_data
# case_data = bing_data[['date','state','city','confirmed','new_confirmed','deaths','new_deaths','recovered','new_recovered','lat','long']]
case_data['active'] = case_data['confirmed'] - (case_data['deaths'] + case_data['recovered'])
case_data['date'] = pd.to_datetime(case_data['date'])
case_data['confirmed']  = case_data['confirmed'].astype('int')
case_data['deaths']  = case_data['deaths'].astype('int')
case_data['recovered']  = case_data['recovered'].astype('int')
case_data['active']  = case_data['active'].astype('int')
case_data['new_confirmed']  = case_data['new_confirmed'].astype('int')
case_data['new_deaths']  = case_data['new_deaths'].astype('int')
case_data['new_recovered']  = case_data['new_recovered'].astype('int')
# case_data.loc[(case_data['state'] == ' Azerbaijan'),'state'] = 'Azerbaijan'

Data analysis

The following analysis techniques are used to depict how the coronavirus pandemic is affecting various demographic groups in India.

General Analysis

state_case_data = case_data.groupby(['state','date']).sum().reset_index()
state_case_data = state_case_data[state_case_data['date'] == max(state_case_data['date'].values)]
state_case_data = state_case_data.drop('date',axis = 1)
state_case_data = state_case_data.set_index('state')
state_case_data = state_case_data[['confirmed','new_confirmed','deaths','new_deaths',
                                       'recovered','new_recovered','active']]
state_case_data['mortality rate'] =  (state_case_data['deaths']/state_case_data['confirmed'])*100                          
state_case_data = state_case_data.rename(columns={'confirmed':'|  confirmed  |','new_confirmed':'|  New confirmed  |',
                                                      'deaths':'|  deaths  |','new_deaths':'|  New deaths  |',
                                                      'recovered':'|  recovered  |','new_recovered':'|  New recovered  |',
                                                      'active':'|  Active  |','mortality rate':'|  Mortality Rate  |'})                          

state_case_data.sort_values('|  confirmed  |', ascending= False).style\
.background_gradient(cmap='binary',subset=["|  confirmed  |"])\
.background_gradient(cmap='Blues',subset=["|  New confirmed  |"])\
.background_gradient(cmap='binary',subset=["|  deaths  |"])\
.background_gradient(cmap='Reds',subset=["|  New deaths  |"])\
.background_gradient(cmap='binary',subset=["|  recovered  |"])\
.background_gradient(cmap='Greens',subset=["|  New recovered  |"])\
.background_gradient(cmap='Purples',subset=["|  Active  |"])\
.background_gradient(cmap='YlOrBr',subset=["|  Mortality Rate  |"])
| confirmed | | New confirmed | | deaths | | New deaths | | recovered | | New recovered | | Active | | Mortality Rate |
state
Maharashtra 223724 6603 9448 198 123192 4634 91084 4.223061
Tamil Nadu 122350 3756 1700 64 74167 3051 46483 1.389456
Delhi 104864 2033 3213 48 78199 3982 23452 3.063969
Gujarat 38333 783 1993 16 27289 569 9051 5.199176
Uttar Pradesh 31156 1188 845 18 20331 704 9980 2.712158
Telangana 29536 1924 324 11 17279 992 11933 1.096966
Karnataka 28877 2062 470 54 11876 778 16531 1.627593
West Bengal 24823 986 827 23 16291 501 7705 3.331588
Andhra Pradesh 22259 1062 264 12 11101 1356 10894 1.186037
Rajasthan 22063 659 482 10 16866 291 4715 2.184653
Haryana 18690 691 282 3 14106 461 4302 1.508828
Madhya Pradesh 16036 409 629 7 11987 219 3420 3.922425
Assam 13336 814 16 2 8729 400 4591 0.119976
Bihar 13189 619 107 3 9554 270 3528 0.811282
Orissa 10624 527 48 6 7006 303 3570 0.451807
Jammu and Kashmir 9261 330 149 6 5567 168 3545 1.608898
Punjab 6907 158 178 3 4828 274 1901 2.577096
Kerala 6195 301 27 0 3559 107 2609 0.435835
Chhattisgarh 3525 110 14 0 2835 84 676 0.397163
Uttarakhand 3258 28 46 3 2650 29 562 1.411909
Jharkhand 3096 100 22 0 2170 66 904 0.710594
Goa 2039 136 8 0 1207 51 824 0.392349
Tripura 1761 57 1 0 1324 76 436 0.056786
Manipur 1435 5 0 0 793 22 642 0.000000
Himachal Pradesh 1101 18 11 0 833 43 257 0.999092
Ladakh 1041 0 1 0 836 0 204 0.096061
Puducherry 1008 78 14 0 480 46 514 1.388889
Nagaland 657 32 0 0 304 61 353 0.000000
Chandigarh 513 19 7 0 402 1 104 1.364522
Dadra and Nagar Haveli and Daman and Diu 408 3 0 0 184 1 224 0.000000
Arunachal Pradesh 287 11 2 0 109 4 176 0.696864
Mizoram 197 0 0 0 133 0 64 0.000000
Andaman and Nicobar Islands 149 2 0 0 77 2 72 0.000000
Sikkim 133 8 0 0 71 1 62 0.000000
Meghalaya 80 0 1 0 43 0 36 1.250000
national_cumulative = pd.DataFrame(case_data.groupby(['date']).sum()).reset_index()
national_cumulative = national_cumulative[national_cumulative['date'] > '2020-03-01']

fig = go.Figure()
fig.add_trace(go.Scatter(x=national_cumulative['date'],y=national_cumulative['confirmed'],mode='lines',name='confirmed',line=dict( width=4)))
fig.add_trace(go.Scatter(x=national_cumulative['date'],y=national_cumulative['deaths'],mode='lines',name='deaths',line=dict( width=4)))
fig.add_trace(go.Scatter(x=national_cumulative['date'],y=national_cumulative['recovered'],mode='lines',name='recovered',line=dict( width=4)))
fig.add_trace(go.Scatter(x=national_cumulative['date'],y=national_cumulative['active'],mode='lines',name='Active',line=dict( width=4)))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.01,y=.98),
                  title_text = 'Number of COVID-19 cases nationwide',font_size=15,
                  xaxis_title="Date",
                  yaxis_title="Number of cases",
                  shapes=[dict(type="rect",xref="x",yref="paper",x0="2020-03-25",y0=0,x1="2020-04-14",y1=1,fillcolor="#D89393",opacity=0.5,layer="below",line_width=0,),
                          dict(type="rect",xref="x",yref="paper",x0="2020-04-14",y0=0,x1="2020-05-03",y1=1,fillcolor="#DA7676",opacity=0.5,layer="below",line_width=0,),
                          dict(type="rect",xref="x",yref="paper",x0="2020-05-03",y0=0,x1="2020-05-17",y1=1,fillcolor="#DD4747",opacity=0.5,layer="below",line_width=0,),
                          dict(type="rect",xref="x",yref="paper",x0="2020-05-17",y0=0,x1="2020-05-31",y1=1,fillcolor="#DF1818",opacity=0.5,layer="below",line_width=0,),
                          dict(type="rect",xref="x",yref="paper",x0="2020-05-31",y0=0,x1=max(national_cumulative['date']),y1=1,fillcolor="#A0DE8A",opacity=0.5,layer="below",line_width=0,)],
                  annotations=[dict(x="2020-04-05",y=max(national_cumulative['confirmed'])-10000,xref="x",yref="y",text="First Lockdown",showarrow=False),
                               dict(x="2020-04-23",y=max(national_cumulative['confirmed'])-10000,xref="x",yref="y",text="Second Lockdown",showarrow=False),
                               dict(x="2020-05-10",y=max(national_cumulative['confirmed'])-10000,xref="x",yref="y",text="Third Lockdown",showarrow=False),
                               dict(x="2020-05-24",y=max(national_cumulative['confirmed'])-10000,xref="x",yref="y",text="Fourth Lockdown",showarrow=False),
                               dict(x="2020-05-24",y=max(national_cumulative['confirmed'])-10000,xref="x",yref="y",text="Fourth Lockdown",showarrow=False),
                               ])

fig.layout.hovermode = 'x'
fig.show()
national_daily_cumulative = pd.DataFrame(case_data.groupby(['date']).sum())

fig = go.Figure()
fig.add_trace(go.Scatter(x=national_daily_cumulative.index,y=national_daily_cumulative['new_confirmed'],mode='lines',name='confirmed',line=dict( width=4)))
fig.add_trace(go.Scatter(x=national_daily_cumulative.index,y=national_daily_cumulative['new_deaths'],mode='lines',name='deaths',line=dict( width=4)))
fig.add_trace(go.Scatter(x=national_daily_cumulative.index,y=national_daily_cumulative['new_recovered'],mode='lines',name='recovered',line=dict( width=4)))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.01,y=.98),
                  title_text = 'Number of daily COVID-19 cases nationwide',font_size=15,
                  xaxis_title="Date",
                  yaxis_title="Number of new cases",)
fig.layout.hovermode = 'x'
fig.show()

Map Visualization

def CreateMap(data,color,fill_color,location = [22,80],zoom = 5,dot_size = 2):
    _map = folium.Map(location=location, tiles="OpenStreetMap", zoom_start=zoom)
    for name,cases,deaths,lat,lon in data.values:
        folium.CircleMarker([lat,lon],radius=((int(np.log(cases + 10)))*dot_size),color=color,fill_color=fill_color,
                            tooltip = "<h5 style='text-align:center;font-weight: bold'>"+ name +"</h5>"+
                            "<hr style='margin:10px;'>"+
                            "<ul style='color: #444;list-style-type:circle;align-item:left;padding-left:20px;padding-right:20px'>"+
                            "<li>confirmed: "+str(cases)+"</li>"+
                            "<li>deaths:   "+str(deaths)+"</li>"+
                            "</ul>",fill_opacity=0.7).add_to(_map)
    return _map

state_map_plot = case_data[case_data['date'] == max(case_data['date'].values)]
state_map_plot = state_map_plot[['state','confirmed','deaths','lat','long']].reset_index().drop('index',axis = 1)
CreateMap(state_map_plot,'#1C6179','#2C94B8',)
Make this Notebook Trusted to load map: File -> Trust Notebook
district_map_plot = bing_data.groupby(['state','city']).max().reset_index()[['state','city','confirmed','deaths','lat','long']]
# district_map_plot = bing_data[bing_data['date'] == max(bing_data['date'].values)]
district_map_plot['location'] = district_map_plot['city'] + ", " + district_map_plot['state']
district_map_plot = district_map_plot[['location','confirmed','deaths','lat','long']]

CreateMap(district_map_plot,'#1C6179','#2C94B8',dot_size = 1)
Make this Notebook Trusted to load map: File -> Trust Notebook
CreateMap(district_map_plot,'#1C6179','#2C94B8',[28.5,77.3],10,4)
Make this Notebook Trusted to load map: File -> Trust Notebook
HTML("<img src='https://upload.wikimedia.org/wikipedia/commons/thumb/9/95/COVID-19_India_Total_Cases_Animated_Map.gif/527px-COVID-19_India_Total_Cases_Animated_Map.gif'>")
# timeline_plot = case_data.groupby(['state','date']).sum().reset_index().sort_values(['date'])
# timeline_plot['date'] = timeline_plot['date'].astype('str')

# fig = px.choropleth(timeline_plot, locations="state",
#                     color=np.log10(timeline_plot["confirmed"]),
#                     hover_name="state",
#                     hover_data=["confirmed",'deaths','recovered'],
#                     color_continuous_scale=px.colors.sequential.thermal_r,
#                     locationmode="IN",
#                     animation_frame='date',color_continuous_midpoint = 3)
# fig.update_layout(margin=dict(l=20,r=0,b=0,t=70,pad=0),
#                   paper_bgcolor="white",
#                   height= 700,
#                   title_text = 'Number of daily COVID-19 cases worldwide',font_size=18)
# fig.show()

Race Map Visualization

case_confirmed_racemap = case_data[['state','date','confirmed']]
case_confirmed_racemap= case_confirmed_racemap.pivot_table(index='state',columns='date',values= 'confirmed')
case_confirmed_racemap.to_csv('country.csv')
files.download('country.csv')
%%HTML
<div class="flourish-embed flourish-bar-chart-race" data-src="visualisation/2554556" data-url="https://flo.uri.sh/visualisation/2554556/embed"><script src="https://public.flourish.studio/resources/embed.js"></script></div>

Comparison between most affected states

case_country = case_data.groupby(['state','date']).sum().reset_index()
countries = case_country[case_country['confirmed'] > 5000]['state'].unique()

def CreateComparisonPlot(attr,title,x_title,y_title, y_axis_type = None):
    fig = go.Figure()
    for i in countries:
        if y_axis_type == 'log' :
            one_country = case_country[(case_country['state'] == i) & (case_country[attr] > 0)][['date',attr]]
            one_country['date'] = [i for i in range(1,len(one_country)+1)]
        else:
            one_country = case_country[(case_country['state'] == i)][['date',attr]]

        fig.add_trace(go.Scatter(x=one_country['date'],
                                y=one_country[attr],mode='lines',
                                name=i,line=dict( width=4)))
        
    # fig.add_annotation(text="First case of United states",
    #                    x='2020-01-23', y=1, arrowhead=0, showarrow=True)
    fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                      paper_bgcolor="white",height= 600,
                      legend=dict(x=.01,y=.98,font=dict(size =12)),
                      title_text = title,font_size=15,
                      xaxis_title=x_title,
                      yaxis_title=y_title)
    if y_axis_type == 'log' : 
        fig.update_yaxes(type="log")
        fig.update_layout(legend=dict(x=.85,y=.02,font=dict(size =12)))
        
    fig.layout.hovermode = 'x'
    fig.show()
CreateComparisonPlot('confirmed','Number of confirmed cases for most affected states','Date','Number of cases')
CreateComparisonPlot('deaths','Number of deaths in most affected states','Date','Number of cases')
CreateComparisonPlot('recovered','Number of recovered cases in most affected states','Date','Number of cases')
CreateComparisonPlot('new_confirmed','Number of Daily confirmed cases in most affected states','Date','Number of cases')
CreateComparisonPlot('new_deaths','Number of Daily Death cases in most affected states','Date','Number of cases')
CreateComparisonPlot('confirmed','Number of confirmed cases for most affected countries',
                     'Day','Number of cases (log scale)','log')
CreateComparisonPlot('deaths','Number of confirmed cases for most affected countries',
                     'Day','Number of cases (log scale)','log')
CreateComparisonPlot('recovered','Number of confirmed cases for most affected countries',
                     'Day','Number of cases (log scale)','log')

Trend of each state separately

case_state= case_data.groupby(['state','date']).sum().reset_index()
case_state['date'] = case_state['date'].astype('str')

countries = case_state[case_state['confirmed'] > 200].sort_values(['confirmed'],ascending=False)['state'].unique()

# row = int((len(countries)+1)/3)
rows = len(countries)
columns = 2
f = plt.figure(figsize=(20,rows*5))
gs = f.add_gridspec(rows,columns)
sns.set(style = "whitegrid")

country = 0
for i in range(0,rows):
    data = case_state[case_state['state'] == countries[country]]
    data = data[data['confirmed'] > 0]
    data['day'] = [i for i in range(1,len(data)+1)]

    for j in range(0,columns):
        #if country == len(countries): break
        ax = f.add_subplot(gs[i,j])

        if j == 0:
            sns.scatterplot(data = data,x = 'day',y = 'confirmed',s = 50,color="#4348C4",edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'confirmed', color = '#4348C4')
            plt.fill_between(data['day'], data['confirmed'], alpha=0.30, color = '#4348C4')

            sns.scatterplot(data = data,x = 'day',y = 'recovered',s= 50,color="#5BAC4D",edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'recovered',color="#5BAC4D")
            plt.fill_between(data['day'], data['recovered'],alpha=0.30,color="#5BAC4D")

            sns.scatterplot(data = data,x = 'day',y = 'deaths',s= 50,color='#BB3535',edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'deaths',color='#BB3535')
            plt.fill_between(data['day'], data['deaths'],alpha=0.30,color='#BB3535')

            ax.legend(['confirmed','recovered','deaths'], fontsize=16,loc = 'upper left')
            ax.set_xlabel('Day',fontsize=20)
            ax.set_ylabel('No. of cases',fontsize=20)
            ax.set_title(countries[country], fontdict={'fontsize': 25, 'weight' : 'bold'}, color="black",loc = 'left')
            
            text = str(data['date'].values[0]) + " - " + str(data['date'].values[-1]) + "\n" + "\n" 
            text += 'Total Cases :-' + "\n" 
            text += 'confirmed :' + str(data['confirmed'].values[-1]) + "\n" 
            text += 'deaths      :' + str(data['deaths'].values[-1]) + "\n" 
            text += 'recovered :' + str(data['recovered'].values[-1]) + "\n" + "\n" 

            ax.text(0.02, 0.15, text, fontsize=15, transform=ax.transAxes,bbox=dict(facecolor='#F8F8F8', alpha=.7))

        if j == 1:
            sns.scatterplot(data = data,x = 'day',y = 'new_confirmed',s = 50,color="#4348C4",edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'new_confirmed', color = '#4348C4')
            plt.fill_between(data['day'], data['new_confirmed'], alpha=0.30, color = '#4348C4')

            sns.scatterplot(data = data,x = 'day',y = 'new_recovered',s= 50,color="#5BAC4D",edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'new_recovered',color="#5BAC4D")
            plt.fill_between(data['day'], data['new_recovered'],alpha=0.30,color="#5BAC4D")

            sns.scatterplot(data = data,x = 'day',y = 'new_deaths',s= 50,color='#BB3535',edgecolor = 'none')
            sns.lineplot(data = data,x = 'day',y = 'new_deaths',color='#BB3535')
            plt.fill_between(data['day'], data['new_deaths'],alpha=0.30,color='#BB3535')
            
            ax.legend(['Daily confirmed','Daily recovered','Daily deaths'], fontsize=16,loc = 'upper left')
            ax.set_xlabel('Day',fontsize=20)
            ax.set_ylabel('No. of cases',fontsize=20)
            
            text = 'In last 24 hrs :-' + "\n" 
            text += 'confirmed :' + str(data['new_confirmed'].values[-1]) + "\n" 
            text += 'deaths      :' + str(data['new_deaths'].values[-1]) + "\n" 
            text += 'recovered :' + str(data['new_recovered'].values[-1]) 

            ax.text(0.02, 0.3, text, fontsize=15, transform=ax.transAxes,bbox=dict(facecolor='#F8F8F8', alpha=.7))

    country += 1

f.tight_layout()

Age Analysis

def GetAgeData(data,feature_name):
    for i in data.index:
        age = data.loc[data.index == i,feature_name]
        try:
            age = int(age)
        except:
            continue
        if age <= 10: data.loc[data.index == i,feature_name] = '1-10'
        if 11 <= age <= 20: data.loc[data.index == i,feature_name] = '11-20'
        if 21 <= age <= 30: data.loc[data.index == i,feature_name] = '21-30'
        if 31 <= age <= 40: data.loc[data.index == i,feature_name] = '31-40'
        if 41 <= age <= 50: data.loc[data.index == i,feature_name] = '41-50'
        if 51 <= age <= 60: data.loc[data.index == i,feature_name] = '51-60'
        if 61 <= age <= 70: data.loc[data.index == i,feature_name] = '61-70'
        if age > 70: data.loc[data.index == i,feature_name] = '70+'

    return data.groupby(feature_name).size().reset_index(name = 'freq')
#  patients_data.loc[(patients_data['Age Bracket'] == '1.5'),'Age Bracket'] = np.nan
#  patients_data.loc[(patients_data['Age Bracket'] == '0.4'),'Age Bracket'] = np.nan
#  patients_data.loc[(patients_data['Age Bracket'] == '0.3'),'Age Bracket'] = np.nan
patients_data.loc[(patients_data['Age Bracket'] == '28-35'),'Age Bracket'] = 31
patients_data.loc[(patients_data['Age Bracket'] == '6 Months'),'Age Bracket'] = 0.5
patients_data['Age Bracket'] = patients_data['Age Bracket'].astype('float')
age_data = GetAgeData(pd.DataFrame(patients_data['Age Bracket'].values,columns= ['Age Bracket']),'Age Bracket')

fig = go.Figure().add_trace(go.Pie(values=age_data['freq'],labels= age_data['Age Bracket'],hole = .5,text=age_data['Age Bracket']))
fig.update_layout(margin=dict(l=0,r=20,b=20,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Percentage of cases recorded by age',font_size=20,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.layout.hovermode = 'x'
fig.show()
age_data_deseased = GetAgeData(pd.DataFrame(patients_data[patients_data['Current Status'] == 'Deceased']['Age Bracket'].values,columns= ['Age Bracket']),'Age Bracket')


fig = go.Figure().add_trace(go.Pie(values=age_data_deseased['freq'],labels= age_data_deseased['Age Bracket'],
                                   hole = .5,text=age_data_deseased['Age Bracket']))
fig.update_layout(margin=dict(l=0,r=20,b=20,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Percentage of cases resulted in death by age',font_size=20,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.layout.hovermode = 'x'
fig.show()

Gender Analysis

temp = pd.DataFrame(patients_data['Gender'].values,columns= ['Gender'])
temp = temp.fillna('NA')
temp.loc[(temp['Gender'] == 'Non-Binary'),'Gender'] = np.nan
gender_data = temp.groupby('Gender').size().reset_index(name = 'size')

fig = go.Figure().add_trace(go.Pie(values = gender_data['size'],labels = gender_data['Gender'],
                                   hole = .5,text=gender_data['Gender']))
fig.update_layout(margin=dict(l=0,r=20,b=20,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Percentage of cases recorded by gender',font_size=20,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.show()
temp = pd.DataFrame(patients_data[patients_data['Current Status'] == 'Deceased']['Gender'].values,columns= ['Gender'])
temp = temp.fillna('NA')
temp.loc[(temp['Gender'] == 'Non-Binary'),'Gender'] = np.nan
gender_data_deseased = temp.groupby('Gender').size().reset_index(name = 'size')

fig = go.Figure().add_trace(go.Pie(values=gender_data_deseased['size'],labels= gender_data_deseased['Gender'],
                                   hole = .5,text=gender_data_deseased['Gender']))
fig.update_layout(margin=dict(l=0,r=20,b=20,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Percentage of cases resulted in death by gender',font_size=20,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.show()

Testing Analysis

state_tests_data.fillna(0,inplace = True)
state_tests_data['Total Tested'] = state_tests_data['Total Tested'].astype('int')
state_tests_data['Positive'] = state_tests_data['Positive'].astype('int')
state_tests_data['Tests per million'] = state_tests_data['Tests per million'].astype('int')
state_tests_data.loc[(state_tests_data['State'] == 'Dadra and Nagar Haveli and Daman and Diu'),'State'] = 'Dadar and Daman'

con = state_data[['State','Confirmed','Deaths']]
tests = state_tests_data.groupby('State')[['Total Tested','Tests per million']].max().reset_index()
# tests = tests.drop('index',axis = 1)
tests = tests.merge(con,how = 'left', on = 'State')
tests.fillna(0,inplace = True)
tests['mortality rate'] =  (tests['Deaths']/tests['Confirmed'])*100
tests['spread rate'] = (tests['Confirmed']/tests['Total Tested'])*100
tests['Confirmed'] = tests['Confirmed'].astype('int')
tests['Deaths'] = tests['Deaths'].astype('int')
tests.fillna(0,inplace = True)
tests_named = tests.rename(columns={'Total Tested':'|  Total Tested  |','Confirmed':'|  Confirmed  |',
                                    'Tests per million':'|  Tests Per Million  |',
                                    'Deaths':'|  Deaths  |','mortality rate':'|  Mortality Rate  |',
                                    'spread rate':'|  Spread Rate  |'})
tests_named = tests_named.set_index('State')
tests_named.sort_values('|  Total Tested  |', ascending= False).style\
.background_gradient(cmap='Blues',subset=["|  Total Tested  |"])\
.background_gradient(cmap='Greens',subset=["|  Tests Per Million  |"])\
.background_gradient(cmap='binary',subset=["|  Confirmed  |"])\
.background_gradient(cmap='Reds',subset=["|  Deaths  |"])\
.background_gradient(cmap='YlOrBr',subset=["|  Mortality Rate  |"])\
.background_gradient(cmap='Purples',subset=["|  Spread Rate  |"])
| Total Tested | | Tests Per Million | | Confirmed | | Deaths | | Mortality Rate | | Spread Rate |
State
Tamil Nadu 1449414 18185 122350 1700 1.389456 8.441343
Maharashtra 1194565 9322 223724 9448 4.223061 18.728491
Andhra Pradesh 1077733 19798 22259 264 1.186037 2.065354
Rajasthan 963454 11915 22212 489 2.201513 2.305455
Uttar Pradesh 956134 3956 31156 845 2.712158 3.258539
Karnataka 759181 10978 28877 471 1.631056 3.803704
Delhi 701859 33178 104864 3213 3.063969 14.940893
West Bengal 572523 5696 24823 827 3.331588 4.335721
Assam 485156 13741 14033 22 0.156773 2.892472
Madhya Pradesh 437930 5076 16036 629 3.922425 3.661772
Gujarat 433864 6160 38419 1994 5.190140 8.855079
Jammu and Kashmir 421571 30767 9261 149 1.608898 2.196783
Punjab 360189 11471 6907 178 2.577096 1.917604
Haryana 332504 11016 18690 282 1.508828 5.620985
Odisha 308698 7069 11201 67 0.598161 3.628465
Kerala 296183 7853 6196 28 0.451904 2.091950
Bihar 275554 2306 13274 100 0.753352 4.817205
Chhattisgarh 191938 6454 3526 14 0.397050 1.837052
Jharkhand 164504 4256 3134 22 0.701978 1.905121
Telangana 134801 3284 29536 324 1.096966 21.910817
Himachal Pradesh 93018 12234 1101 10 0.908265 1.183642
Uttarakhand 83900 7145 3258 46 1.411909 3.883194
Goa 82555 50021 2039 8 0.392349 2.469869
Tripura 75641 18301 1773 1 0.056402 2.343967
Manipur 57769 18235 1435 0 0.000000 2.484031
Dadar and Daman 34444 35917 0 0 0.000000 0.000000
Arunachal Pradesh 28581 18381 287 2 0.696864 1.004164
Puducherry 22743 14217 1200 16 1.333333 5.276349
Meghalaya 22000 6669 100 1 1.000000 0.454545
Nagaland 21980 9527 660 0 0.000000 3.002730
Andaman and Nicobar Islands 17381 43060 151 0 0.000000 0.868765
Mizoram 15183 12589 203 0 0.000000 1.337022
Ladakh 14938 50625 1047 1 0.095511 7.008970
Sikkim 11820 17179 133 0 0.000000 1.125212
Chandigarh 8833 7233 507 7 1.380671 5.739839
tests = tests.sort_values('Total Tested')

fig = go.Figure()
fig.add_trace(go.Bar(y=tests['State'],x=tests['Total Tested'],
                     orientation = 'h',text = tests['Total Tested'],textposition = 'outside',
                     name='Confirmed',marker= { 'color': 'rgb(47,138,0)'}))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 800,
                  legend=dict(x=.01,y=.98),
                  title_text = 'Comparing number of tests done by states',font_size=15,
                  yaxis_title="State",
                  xaxis_title="Number of tests (in million)",)
fig.layout.hovermode = 'y'
fig.show()
fig = go.Figure()
fig.add_trace(go.Bar(y=tests['State'],x=tests['Tests per million'],
                     orientation='h',text = tests['Tests per million'],textposition = 'outside',
                     name='Confirmed',marker= { 'color': 'rgb(105,67,144)'}))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 800,
                  legend=dict(x=.01,y=.98),
                  title_text = 'Number of tests per million of population in states',font_size=15,
                  yaxis_title="State",
                  xaxis_title="Number of tests per million",)
fig.layout.hovermode = 'y'
fig.show()
fig = go.Figure()
fig.add_trace(go.Bar(y=tests['State'],x=tests['Tests per million'],orientation = 'h',
                     name = 'Tests per million',marker= { 'color': 'rgb(105,67,144)'}))
fig.add_trace(go.Bar(y=tests['State'],x=tests['Total Tested'],orientation = 'h',
                     text = tests['Tests per million'],textposition = 'outside',
                      name = 'Total Tests',marker= { 'color': 'rgb(47,138,0)'}))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 800,
                  legend=dict(x=.825,y=.1),
                  title_text = 'No. of tests and No. of test per million comparison',font_size=15,
                  yaxis_title="State",
                  xaxis_title="Number of tests",
                  barmode='stack')
fig.layout.hovermode = 'y'
fig.show()

Mortality and Spread Rates Comparison

national_case_data = case_data[case_data['date'] > '2020-03-25'].groupby('date').sum().reset_index()
national_case_data['mortality Rate'] = (national_case_data['deaths']/national_case_data['confirmed'])*100

fig = go.Figure()
fig.add_trace(go.Scatter(x=national_case_data['date'],y=national_case_data['mortality Rate'],mode='lines+markers',
                         fill='tozeroy',name = 'Total Tests',marker= { 'color': '#B87625','size' : 10},line=dict( width=4)))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'National Mortality Rate',font_size=15,
                  xaxis_title="Date",
                  yaxis_title="Rate")
fig.layout.hovermode = 'x'
fig.show()
tests_mortality = tests[tests['mortality rate']>0].sort_values('mortality rate',ascending = True)

fig = go.Figure()
fig.add_trace(go.Bar(y=tests_mortality['State'],x=tests_mortality['mortality rate'],
                     orientation = 'h',text = tests['mortality rate'],textposition = 'outside',
                     name = 'Total Tests',marker= { 'color': '#D38B2C'}))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Mortality Rate (No. of confirmed / No. of deaths)',font_size=15,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.layout.hovermode = 'y'
fig.show()
tests_spread = tests.sort_values('spread rate',ascending = True).head(40)

fig = go.Figure()
fig.add_trace(go.Bar(y=tests_spread['State'],x=tests_spread['spread rate'],orientation = 'h',
                     text = tests['spread rate'],textposition = 'outside',
                     name = 'Total Tests',marker= { 'color': '#B325B8'}))
fig.update_layout(margin=dict(l=0,r=20,b=0,t=60,pad=0),
                  paper_bgcolor="white",height= 800,
                  legend=dict(x=.825,y=.98),
                  title_text = 'Spreat Rate (No. of Tests / No. of confirmed cases)',font_size=15,
                  xaxis_title="Country",
                  yaxis_title="Rate")
fig.layout.hovermode = 'x'
fig.show()

108 countries where India supplied HCQ/Paracetamol

HTML(''' <iframe title="[Covid-19: India is supplying HCQ, Paracetamol to 108 countries ]" aria-label="Map" id="datawrapper-chart-kqJFM" src="https://datawrapper.dwcdn.net/kqJFM/1/" scrolling="no" frameborder="0" style="width: 0; min-width: 100% !important; border: none;" height="537"></iframe><script type="text/javascript">!function(){"use strict";window.addEventListener("message",(function(a){if(void 0!==a.data["datawrapper-height"])for(var e in a.data["datawrapper-height"]){var t=document.getElementById("datawrapper-chart-"+e)||document.querySelector("iframe[src*='"+e+"']");t&&(t.style.height=a.data["datawrapper-height"][e]+"px")}}))}();
</script> ''')

Containment Zones

zones[zones['Zone'] == 'Red Zone'][['District','State','Zone']].reset_index().drop('index',axis=1).style.set_properties(**{'background-color': 'white',
                                                                                   'color': 'black',
                                                                                   'border-color': 'white'})
District State Zone
0 South Andamans Andaman And Nicobar Islands Red Zone
1 Kurnool Andhra Pradesh Red Zone
2 Guntur Andhra Pradesh Red Zone
3 Krishna Andhra Pradesh Red Zone
4 Chittoor Andhra Pradesh Red Zone
5 Spsr Nellore Andhra Pradesh Red Zone
6 Munger Bihar Red Zone
7 Patna Bihar Red Zone
8 Rohtas Bihar Red Zone
9 Buxar Bihar Red Zone
10 Gaya Bihar Red Zone
11 Chandigarh Chandigarh Red Zone
12 Raipur Chhattisgarh Red Zone
13 South East Delhi Red Zone
14 Central Delhi Red Zone
15 North Delhi Red Zone
16 South Delhi Red Zone
17 North East Delhi Red Zone
18 West Delhi Red Zone
19 Shahdara Delhi Red Zone
20 East Delhi Red Zone
21 New Delhi Delhi Red Zone
22 North West Delhi Red Zone
23 South West Delhi Red Zone
24 Ahmadabad Gujarat Red Zone
25 Surat Gujarat Red Zone
26 Vadodara Gujarat Red Zone
27 Anand Gujarat Red Zone
28 Banas Kantha Gujarat Red Zone
29 Panch Mahals Gujarat Red Zone
30 Bhavnagar Gujarat Red Zone
31 Gandhinagar Gujarat Red Zone
32 ArvaIii Gujarat Red Zone
33 Sonipat Haryana Red Zone
34 Faridabad Haryana Red Zone
35 Bandipora Jammu And Kashmir Red Zone
36 Shopian Jammu And Kashmir Red Zone
37 Anantnag Jammu And Kashmir Red Zone
38 Srinagar Jammu And Kashmir Red Zone
39 Ranchi Jharkhand Red Zone
40 Bengaluru Urban Karnataka Red Zone
41 Mysuru Karnataka Red Zone
42 Bengaluru Rural Karnataka Red Zone
43 Kannur Kerala Red Zone
44 Kottayam Kerala Red Zone
45 Indore Madhya Pradesh Red Zone
46 Bhopal Madhya Pradesh Red Zone
47 Ujjain Madhya Pradesh Red Zone
48 Jabalpur Madhya Pradesh Red Zone
49 Dhar Madhya Pradesh Red Zone
50 Barwani Madhya Pradesh Red Zone
51 East Nimar Madhya Pradesh Red Zone
52 Dewas Madhya Pradesh Red Zone
53 Gwalior Madhya Pradesh Red Zone
54 Mumbai Maharashtra Red Zone
55 Pune Maharashtra Red Zone
56 Thane Maharashtra Red Zone
57 Nashik Maharashtra Red Zone
58 Palghar Maharashtra Red Zone
59 Nagpur Maharashtra Red Zone
60 Solapur Maharashtra Red Zone
61 Yavatmal Maharashtra Red Zone
62 Aurangabad Maharashtra Red Zone
63 Satara Maharashtra Red Zone
64 Dhule Maharashtra Red Zone
65 Ako la Maharashtra Red Zone
66 Jalgaon Maharashtra Red Zone
67 Mumbai Suburban Maharashtra Red Zone
68 Jajapur Orrisa Red Zone
69 Bhadrak Orrisa Red Zone
70 Baleshwar Orrisa Red Zone
71 Jalandhar Punjab Red Zone
72 Patiala Punjab Red Zone
73 Ludhiana Punjab Red Zone
74 Jaipur Rajasthan Red Zone
75 Jodhpur Rajasthan Red Zone
76 Kota Rajasthan Red Zone
77 Ajmer Rajasthan Red Zone
78 Bharatpur Rajasthan Red Zone
79 Nagaur Rajasthan Red Zone
80 Banswara Rajasthan Red Zone
81 Jhalawar Rajasthan Red Zone
82 Chennai Tamil Nadu Red Zone
83 Madurai Tamil Nadu Red Zone
84 Namakkal Tamil Nadu Red Zone
85 Thanjavur Tamil Nadu Red Zone
86 Chengalpattu Tamil Nadu Red Zone
87 Thiruvallur Tamil Nadu Red Zone
88 Tiruppur Tamil Nadu Red Zone
89 Rani pet Tamil Nadu Red Zone
90 Virudhunagar Tamil Nadu Red Zone
91 Thiruvarur Tamil Nadu Red Zone
92 Ve II ore Tamil Nadu Red Zone
93 Kanchipuram Tamil Nadu Red Zone
94 Hyderabad Telangana Red Zone
95 Surya pet Telangana Red Zone
96 Ranga Reddy Telangana Red Zone
97 MedchalMalkajgiri Telangana Red Zone
98 Vikarabad Telangana Red Zone
99 Warangal Urban Telangana Red Zone
100 Agra Uttar Pradesh Red Zone
101 Lucknow Uttar Pradesh Red Zone
102 Saharanpur Uttar Pradesh Red Zone
103 Kanpur Nagar Uttar Pradesh Red Zone
104 Moradabad Uttar Pradesh Red Zone
105 Firozabad Uttar Pradesh Red Zone
106 Gautam Buddha Nagar Uttar Pradesh Red Zone
107 Bulandshahr Uttar Pradesh Red Zone
108 Meerut Uttar Pradesh Red Zone
109 Rae Bareli Uttar Pradesh Red Zone
110 Varanasi Uttar Pradesh Red Zone
111 Bijnor Uttar Pradesh Red Zone
112 Amroha Uttar Pradesh Red Zone
113 Sant Kabeer Nagar Uttar Pradesh Red Zone
114 Aligarh Uttar Pradesh Red Zone
115 Muzaffarnagar Uttar Pradesh Red Zone
116 Rampur Uttar Pradesh Red Zone
117 Mathura Uttar Pradesh Red Zone
118 Bareilly Uttar Pradesh Red Zone
119 Haridwar Uttarakhand Red Zone
120 Kolkata West Bengal Red Zone
121 Howrah West Bengal Red Zone
122 24 Paraganas North West Bengal Red Zone
123 24 Paraganas South West Bengal Red Zone
124 Medinipur West West Bengal Red Zone
125 Medinipur East West Bengal Red Zone
126 Darjeeling West Bengal Red Zone
127 Jalpaiguri West Bengal Red Zone
128 Kalimpong West Bengal Red Zone
129 Maldah West Bengal Red Zone
zones[zones['Zone'] == 'Orange Zone'][['District','State','Zone']].reset_index().drop('index',axis=1).style.set_properties(**{'background-color': 'white',
                                                                                   'color': 'black',
                                                                                   'border-color': 'white'})
District State Zone
0 West Godavari Andhra Pradesh Orange Zone
1 YSR Andhra Pradesh Orange Zone
2 Anantapur Andhra Pradesh Orange Zone
3 Prakasam Andhra Pradesh Orange Zone
4 East Godavari Andhra Pradesh Orange Zone
5 Srikakulam Andhra Pradesh Orange Zone
6 Visakhapatanam Andhra Pradesh Orange Zone
7 Dhubri Assam Orange Zone
8 Marigaon Assam Orange Zone
9 Goalpara Assam Orange Zone
10 Nalanda Bihar Orange Zone
11 Kaimur (Bhabua) Bihar Orange Zone
12 Siwan Bihar Orange Zone
13 Gopalganj Bihar Orange Zone
14 Bhojpur Bihar Orange Zone
15 Begusarai Bihar Orange Zone
16 Aurangabad Bihar Orange Zone
17 Madhubani Bihar Orange Zone
18 Purbi Champaran Bihar Orange Zone
19 Bhagalpur Bihar Orange Zone
20 Arwal Bihar Orange Zone
21 Saran Bihar Orange Zone
22 Nawada Bihar Orange Zone
23 Lakhisarai Bihar Orange Zone
24 Banka Bihar Orange Zone
25 Vaishali Bihar Orange Zone
26 Darbhanga Bihar Orange Zone
27 Jehanabad Bihar Orange Zone
28 Madhepura Bihar Orange Zone
29 Purnia Bihar Orange Zone
30 Korba Chhattisgarh Orange Zone
31 Rajkot Gujarat Orange Zone
32 Bharuch Gujarat Orange Zone
33 Botad Gujarat Orange Zone
34 Narmada Gujarat Orange Zone
35 Chhotaudepur Gujarat Orange Zone
36 Mahisagar Gujarat Orange Zone
37 Mahesana Gujarat Orange Zone
38 Patan Gujarat Orange Zone
39 Kheda Gujarat Orange Zone
40 Valsad Gujarat Orange Zone
41 Dohad Gujarat Orange Zone
42 Kachchh Gujarat Orange Zone
43 Navsari Gujarat Orange Zone
44 GirSomnath Gujarat Orange Zone
45 Dang Gujarat Orange Zone
46 SabarKantha Gujarat Orange Zone
47 Tapi Gujarat Orange Zone
48 Jamnagar Gujarat Orange Zone
49 Surendranagar Gujarat Orange Zone
50 Gurugram Haryana Orange Zone
51 Nuh Haryana Orange Zone
52 Panipat Haryana Orange Zone
53 Panchkula Haryana Orange Zone
54 Palwal Haryana Orange Zone
55 Rohtak Haryana Orange Zone
56 Hisar Haryana Orange Zone
57 Ambala Haryana Orange Zone
58 Jhajjar Haryana Orange Zone
59 Bhiwani Haryana Orange Zone
60 Kaithal Haryana Orange Zone
61 Kurukshetra Haryana Orange Zone
62 Karna I Haryana Orange Zone
63 Jind Haryana Orange Zone
64 Sirsa Haryana Orange Zone
65 Yamunanagar Haryana Orange Zone
66 Fatehabad Haryana Orange Zone
67 Charki Dadri Haryana Orange Zone
68 Una Himachal Pradesh Orange Zone
69 Chamba Himachal Pradesh Orange Zone
70 Hamirpur Himachal Pradesh Orange Zone
71 Kangra Himachal Pradesh Orange Zone
72 Sirmaur Himachal Pradesh Orange Zone
73 Solan Himachal Pradesh Orange Zone
74 Baramulla Jammu And Kashmir Orange Zone
75 Kupwara Jammu And Kashmir Orange Zone
76 Ganderbal Jammu And Kashmir Orange Zone
77 Jammu Jammu And Kashmir Orange Zone
78 Udhampur Jammu And Kashmir Orange Zone
79 Kulgam Jammu And Kashmir Orange Zone
80 Budgam Jammu And Kashmir Orange Zone
81 Samba Jammu And Kashmir Orange Zone
82 Kathua Jammu And Kashmir Orange Zone
83 Rajouri Jammu And Kashmir Orange Zone
84 Ramban Jammu And Kashmir Orange Zone
85 Reasi Jammu And Kashmir Orange Zone
86 Bokaro Jharkhand Orange Zone
87 Garhwa Jharkhand Orange Zone
88 Dhanbad Jharkhand Orange Zone
89 Deoghar Jharkhand Orange Zone
90 Hazaribagh Jharkhand Orange Zone
91 Simdega Jharkhand Orange Zone
92 Giridih Jharkhand Orange Zone
93 Koderma Jharkhand Orange Zone
94 Jamtara Jharkhand Orange Zone
95 Belagavi Karnataka Orange Zone
96 Vijayapura Karnataka Orange Zone
97 Kalaburagi Karnataka Orange Zone
98 Bagalkote Karnataka Orange Zone
99 Mandya Karnataka Orange Zone
100 Ballari Karnataka Orange Zone
101 Dharwad Karnataka Orange Zone
102 Dakshina Kannada Karnataka Orange Zone
103 Bidar Karnataka Orange Zone
104 Chikkaballapura Karnataka Orange Zone
105 Gadag Karnataka Orange Zone
106 Uttara Kannada Karnataka Orange Zone
107 Tumakuru Karnataka Orange Zone
108 Kasaragod Kerala Orange Zone
109 ldukki Kerala Orange Zone
110 Kozhikode Kerala Orange Zone
111 Kollam Kerala Orange Zone
112 Palakkad Kerala Orange Zone
113 Pathanamthitta Kerala Orange Zone
114 Malappuram Kerala Orange Zone
115 Thiruvananthapuram Kerala Orange Zone
116 Alappuzha Kerala Orange Zone
117 Thrissur Kerala Orange Zone
118 Lehladakh Ladakh Orange Zone
119 Kargil Ladakh Orange Zone
120 Khargone Madhya Pradesh Orange Zone
121 Raisen Madhya Pradesh Orange Zone
122 Hoshangabad Madhya Pradesh Orange Zone
123 Ratlam Madhya Pradesh Orange Zone
124 Agar Malwa Madhya Pradesh Orange Zone
125 Mandsaur Madhya Pradesh Orange Zone
126 Sagar Madhya Pradesh Orange Zone
127 Shajapur Madhya Pradesh Orange Zone
128 Chhindwara Madhya Pradesh Orange Zone
129 Alirajpur Madhya Pradesh Orange Zone
130 Tikamgarh Madhya Pradesh Orange Zone
131 Shahdol Madhya Pradesh Orange Zone
132 Sheopur Madhya Pradesh Orange Zone
133 Dindori Madhya Pradesh Orange Zone
134 Burhanpur Madhya Pradesh Orange Zone
135 Harda Madhya Pradesh Orange Zone
136 Betul Madhya Pradesh Orange Zone
137 Vidisha Madhya Pradesh Orange Zone
138 Morena Madhya Pradesh Orange Zone
139 Raigad Maharashtra Orange Zone
140 Ahmednagar Maharashtra Orange Zone
141 Amravati Maharashtra Orange Zone
142 Buldhana Maharashtra Orange Zone
143 Nandurbar Maharashtra Orange Zone
144 Kolhapur Maharashtra Orange Zone
145 Hingoli Maharashtra Orange Zone
146 Ratnagiri Maharashtra Orange Zone
147 Jalna Maharashtra Orange Zone
148 Nanded Maharashtra Orange Zone
149 Chandrapur Maharashtra Orange Zone
150 Parbhani Maharashtra Orange Zone
151 Sangli Maharashtra Orange Zone
152 Latur Maharashtra Orange Zone
153 Bhandara Maharashtra Orange Zone
154 Beed Maharashtra Orange Zone
155 East Khasi Hills Meghalaya Orange Zone
156 Khordha Orrisa Orange Zone
157 Sundargarh Orrisa Orange Zone
158 Kendrapara Orrisa Orange Zone
159 Kora put Orrisa Orange Zone
160 Dhenkanal Orrisa Orange Zone
161 Kalahandi Orrisa Orange Zone
162 Pondicherry Puducherry Orange Zone
163 SAS Nagar Punjab Orange Zone
164 Pathankot Punjab Orange Zone
165 Mansa Punjab Orange Zone
166 Tarn Taran Punjab Orange Zone
167 Amritsar Punjab Orange Zone
168 Kapurthala Punjab Orange Zone
169 Hoshiarpur Punjab Orange Zone
170 Faridkot Punjab Orange Zone
171 Sangrur Punjab Orange Zone
172 Shahid Bhagat Singh Nagar (Nawanshahr) Punjab Orange Zone
173 Firozepur Punjab Orange Zone
174 Sri Muktsar Sahib Punjab Orange Zone
175 Moga Punjab Orange Zone
176 Gurdaspur Punjab Orange Zone
177 Barna la Punjab Orange Zone
178 Tonk Rajasthan Orange Zone
179 Jaisalmer Rajasthan Orange Zone
180 Dausa Rajasthan Orange Zone
181 Jhunjhunu Rajasthan Orange Zone
182 Hanumangarh Rajasthan Orange Zone
183 Bhilwara Rajasthan Orange Zone
184 Sawai Madhaopur Rajasthan Orange Zone
185 Chittorgarh Rajasthan Orange Zone
186 Dungarpur Rajasthan Orange Zone
187 Udaipur Rajasthan Orange Zone
188 Dholpur Rajasthan Orange Zone
189 Sikar Rajasthan Orange Zone
190 Alwar Rajasthan Orange Zone
191 Bikaner Rajasthan Orange Zone
192 Churu Rajasthan Orange Zone
193 Pali Rajasthan Orange Zone
194 Barmer Rajasthan Orange Zone
195 Karauli Rajasthan Orange Zone
196 Rajsamand Rajasthan Orange Zone
197 Theni Tamil Nadu Orange Zone
198 Tenkasi Tamil Nadu Orange Zone
199 Nagapattinam Tamil Nadu Orange Zone
200 Dindigul Tamil Nadu Orange Zone
201 Villupuram Tamil Nadu Orange Zone
202 Coimbatore Tamil Nadu Orange Zone
203 Cuddalore Tamil Nadu Orange Zone
204 Salem Tamil Nadu Orange Zone
205 Karur Tamil Nadu Orange Zone
206 Tuticorin Tamil Nadu Orange Zone
207 Tiruchirappalli Tamil Nadu Orange Zone
208 Tirupathur Tamil Nadu Orange Zone
209 Kanniyakumari Tamil Nadu Orange Zone
210 Tiruvannamalai Tamil Nadu Orange Zone
211 Ramanathapuram Tamil Nadu Orange Zone
212 Tirunelveli Tamil Nadu Orange Zone
213 The Nilgiris Tamil Nadu Orange Zone
214 Sivaganga Tamil Nadu Orange Zone
215 Perambalur Tamil Nadu Orange Zone
216 Kallakurichi Tamil Nadu Orange Zone
217 Ariyalur Tamil Nadu Orange Zone
218 Erode Tamil Nadu Orange Zone
219 Pudukkottai Tamil Nadu Orange Zone
220 Dharmapuri Tamil Nadu Orange Zone
221 Nizamabad Telangana Orange Zone
222 JogulambaGadwal Telangana Orange Zone
223 Nirmal Telangana Orange Zone
224 Nalgonda Telangana Orange Zone
225 Adilabad Telangana Orange Zone
226 Sangareddy Telangana Orange Zone
227 Kama reddy Telangana Orange Zone
228 KumuramBheemAsifabad Telangana Orange Zone
229 Karimnagar Telangana Orange Zone
230 Khammam Telangana Orange Zone
231 Mahabubnagar Telangana Orange Zone
232 Jagitial Telangana Orange Zone
233 RajannaSircilla Telangana Orange Zone
234 JayashankarBhupalapa lly Telangana Orange Zone
235 Medak Telangana Orange Zone
236 Jangoan Telangana Orange Zone
237 Narayanpet Telangana Orange Zone
238 Manche rial Telangana Orange Zone
239 North Tripura Tripura Orange Zone
240 Gomati Tripura Orange Zone
241 Ghaziabad Uttar Pradesh Orange Zone
242 Hapur Uttar Pradesh Orange Zone
243 Baghpat Uttar Pradesh Orange Zone
244 Basti Uttar Pradesh Orange Zone
245 Budaun Uttar Pradesh Orange Zone
246 Sambhal Uttar Pradesh Orange Zone
247 Auraiya Uttar Pradesh Orange Zone
248 Sham Ii Uttar Pradesh Orange Zone
249 Sitapur Uttar Pradesh Orange Zone
250 Bahraich Uttar Pradesh Orange Zone
251 Kannauj Uttar Pradesh Orange Zone
252 Azamgarh Uttar Pradesh Orange Zone
253 Mainpuri Uttar Pradesh Orange Zone
254 Shravasti Uttar Pradesh Orange Zone
255 Banda Uttar Pradesh Orange Zone
256 Jaunpur Uttar Pradesh Orange Zone
257 Etah Uttar Pradesh Orange Zone
258 Kasganj Uttar Pradesh Orange Zone
259 Sultanpur Uttar Pradesh Orange Zone
260 Prayagraj Uttar Pradesh Orange Zone
261 Jalaun Uttar Pradesh Orange Zone
262 Mirzapur Uttar Pradesh Orange Zone
263 Etawah Uttar Pradesh Orange Zone
264 Pratapgarh Uttar Pradesh Orange Zone
265 Ghazipur Uttar Pradesh Orange Zone
266 Gonda Uttar Pradesh Orange Zone
267 Mau Uttar Pradesh Orange Zone
268 Bhadohi Uttar Pradesh Orange Zone
269 Unnao Uttar Pradesh Orange Zone
270 Pilibhit Uttar Pradesh Orange Zone
271 Balrampur Uttar Pradesh Orange Zone
272 Ayodhya Uttar Pradesh Orange Zone
273 Gorakhpur Uttar Pradesh Orange Zone
274 Jhansi Uttar Pradesh Orange Zone
275 Hardoi Uttar Pradesh Orange Zone
276 Kaushambi Uttar Pradesh Orange Zone
277 Dehradun Uttarakhand Orange Zone
278 Nainital Uttarakhand Orange Zone
279 Hooghly West Bengal Orange Zone
280 Paschim Bardhaman West Bengal Orange Zone
281 Nadia West Bengal Orange Zone
282 Purba Bardhaman West Bengal Orange Zone
283 Murshidabad West Bengal Orange Zone
zones[zones['Zone'] == 'Green Zone'][['District','State','Zone']].reset_index().drop('index',axis=1).style.set_properties(**{'background-color': 'white',
                                                                                   'color': 'black',
                                                                                   'border-color': 'white'})
District State Zone
0 Nicobars Andaman And Nicobar Islands Green Zone
1 North And Middle Andaman Andaman And Nicobar Islands Green Zone
2 Vizianagaram Andhra Pradesh Green Zone
3 Lohit Arunachal Pradesh Green Zone
4 Changlang Arunachal Pradesh Green Zone
5 Dibang Valley Arunachal Pradesh Green Zone
6 East Kameng Arunachal Pradesh Green Zone
7 East Siang Arunachal Pradesh Green Zone
8 KurungKumey Arunachal Pradesh Green Zone
9 Lower Dibang Valley Arunachal Pradesh Green Zone
10 Lower Subansiri Arunachal Pradesh Green Zone
11 Papum Pare Arunachal Pradesh Green Zone
12 Tawang Arunachal Pradesh Green Zone
13 Tirap Arunachal Pradesh Green Zone
14 Upper Siang Arunachal Pradesh Green Zone
15 Upper Subansiri Arunachal Pradesh Green Zone
16 West Kameng Arunachal Pradesh Green Zone
17 West Siang Arunachal Pradesh Green Zone
18 Anjaw Arunachal Pradesh Green Zone
19 Longding Arunachal Pradesh Green Zone
20 KraDaadi Arunachal Pradesh Green Zone
21 Namsai Arunachal Pradesh Green Zone
22 Siang Arunachal Pradesh Green Zone
23 Kamle Arunachal Pradesh Green Zone
24 Lower Siang Arunachal Pradesh Green Zone
25 PakkeKessang Arunachal Pradesh Green Zone
26 Leparada Arunachal Pradesh Green Zone
27 Shi Yomi Arunachal Pradesh Green Zone
28 Golaghat Assam Green Zone
29 Karimganj Assam Green Zone
30 Nalbari Assam Green Zone
31 Hailakandi Assam Green Zone
32 Cachar Assam Green Zone
33 Kamrup Assam Green Zone
34 Lakhimpur Assam Green Zone
35 Kamrup Metro Assam Green Zone
36 South SalmaraMancachar Assam Green Zone
37 Barpeta Assam Green Zone
38 Bongaigaon Assam Green Zone
39 Darrang Assam Green Zone
40 Dhemaji Assam Green Zone
41 Dibrugarh Assam Green Zone
42 Jorhat Assam Green Zone
43 KarbiAnglong Assam Green Zone
44 Kokrajhar Assam Green Zone
45 Nagaon Assam Green Zone
46 Dima Hasao Assam Green Zone
47 Sivasagar Assam Green Zone
48 Sonitpur Assam Green Zone
49 Tinsukia Assam Green Zone
50 Chi rang Assam Green Zone
51 Baksa Assam Green Zone
52 Udalguri Assam Green Zone
53 Biswanath Assam Green Zone
54 Majuli Assam Green Zone
55 Charaideo Assam Green Zone
56 Hojai Assam Green Zone
57 West KarbiAnglong Assam Green Zone
58 Sheikhpura Bihar Green Zone
59 Araria Bihar Green Zone
60 Jamui Bihar Green Zone
61 Katihar Bihar Green Zone
62 Khagaria Bihar Green Zone
63 Kishanganj Bihar Green Zone
64 Muzaffarpur Bihar Green Zone
65 Pashchim Champaran Bihar Green Zone
66 Saharsa Bihar Green Zone
67 Samastipur Bihar Green Zone
68 Sheohar Bihar Green Zone
69 Sitamarhi Bihar Green Zone
70 Supaul Bihar Green Zone
71 Surajpur Chhattisgarh Green Zone
72 Bilaspur Chhattisgarh Green Zone
73 Durg Chhattisgarh Green Zone
74 Rajnandgaon Chhattisgarh Green Zone
75 Ba star Chhattisgarh Green Zone
76 Dantewada Chhattisgarh Green Zone
77 Dhamtari Chhattisgarh Green Zone
78 Janjgir-Champa Chhattisgarh Green Zone
79 Jashpur Chhattisgarh Green Zone
80 Kanker Chhattisgarh Green Zone
81 Kabirdham Chhattisgarh Green Zone
82 Korea Chhattisgarh Green Zone
83 Mahasamund Chhattisgarh Green Zone
84 Raigarh Chhattisgarh Green Zone
85 Surguja Chhattisgarh Green Zone
86 Bijapur Chhattisgarh Green Zone
87 Narayanpur Chhattisgarh Green Zone
88 Sukma Chhattisgarh Green Zone
89 Kondagaon Chhattisgarh Green Zone
90 Baloda Bazar Chhattisgarh Green Zone
91 Gariyaband Chhattisgarh Green Zone
92 Balod Chhattisgarh Green Zone
93 Mungeli Chhattisgarh Green Zone
94 Balrampur Chhattisgarh Green Zone
95 Bemetara Chhattisgarh Green Zone
96 Dadra And Nagar Haveli Dadra And Nagar Haveli Green Zone
97 Daman Daman And Diu Green Zone
98 Diu Daman And Diu Green Zone
99 North Goa Goa Green Zone
100 South Goa Goa Green Zone
101 Morbi Gujarat Green Zone
102 Amreli Gujarat Green Zone
103 Porbandar Gujarat Green Zone
104 Junagadh Gujarat Green Zone
105 Devbhumi Dwarka Gujarat Green Zone
106 Mahendragarh Haryana Green Zone
107 Rewari Haryana Green Zone
108 Bilaspur Himachal Pradesh Green Zone
109 Kinnaur Himachal Pradesh Green Zone
110 Kullu Himachal Pradesh Green Zone
111 Lahul And Spiti Himachal Pradesh Green Zone
112 Mandi Himachal Pradesh Green Zone
113 Shimla Himachal Pradesh Green Zone
114 Pulwama Jammu And Kashmir Green Zone
115 Kishtwar Jammu And Kashmir Green Zone
116 Doda Jammu And Kashmir Green Zone
117 Poonch Jammu And Kashmir Green Zone
118 Chatra Jharkhand Green Zone
119 Dumka Jharkhand Green Zone
120 East Singhbum Jharkhand Green Zone
121 Godda Jharkhand Green Zone
122 Gumla Jharkhand Green Zone
123 Latehar Jharkhand Green Zone
124 Lohardaga Jharkhand Green Zone
125 Pakur Jharkhand Green Zone
126 Palamu Jharkhand Green Zone
127 Sahebganj Jharkhand Green Zone
128 Saraikela Kharsawan Jharkhand Green Zone
129 West Singhbhum Jharkhand Green Zone
130 Khunti Jharkhand Green Zone
131 Ramgarh Jharkhand Green Zone
132 Davangere Karnataka Green Zone
133 Udupi Karnataka Green Zone
134 Chamarajanagara Karnataka Green Zone
135 Chikkamagaluru Karnataka Green Zone
136 Chitradurga Karnataka Green Zone
137 Hassan Karnataka Green Zone
138 Haveri Karnataka Green Zone
139 Kodagu Karnataka Green Zone
140 Kolar Karnataka Green Zone
141 Koppa I Karnataka Green Zone
142 Raichur Karnataka Green Zone
143 Shivamogga Karnataka Green Zone
144 Ramanagara Karnataka Green Zone
145 Yadgir Karnataka Green Zone
146 Ernakulam Kerala Green Zone
147 Wayanad Kerala Green Zone
148 Lakshadweep District Lakshadweep Green Zone
149 Rewa Madhya Pradesh Green Zone
150 Ashoknagar Madhya Pradesh Green Zone
151 Rajgarh Madhya Pradesh Green Zone
152 Shivpuri Madhya Pradesh Green Zone
153 Anuppur Madhya Pradesh Green Zone
154 Balaghat Madhya Pradesh Green Zone
155 Bhind Madhya Pradesh Green Zone
156 Chhatarpur Madhya Pradesh Green Zone
157 Da oh Madhya Pradesh Green Zone
158 Datia Madhya Pradesh Green Zone
159 Guna Madhya Pradesh Green Zone
160 Jhabua Madhya Pradesh Green Zone
161 Katni Madhya Pradesh Green Zone
162 Mandia Madhya Pradesh Green Zone
163 Narsinghpur Madhya Pradesh Green Zone
164 Nee much Madhya Pradesh Green Zone
165 Panna Madhya Pradesh Green Zone
166 Satna Madhya Pradesh Green Zone
167 Sehore Madhya Pradesh Green Zone
168 Seoni Madhya Pradesh Green Zone
169 Sid hi Madhya Pradesh Green Zone
170 Umaria Madhya Pradesh Green Zone
171 Singrauli Madhya Pradesh Green Zone
172 Niwari Madhya Pradesh Green Zone
173 Osmanabad Maharashtra Green Zone
174 Washim Maharashtra Green Zone
175 Sindhudurg Maharashtra Green Zone
176 Gandia Maharashtra Green Zone
177 Gadchiroli Maharashtra Green Zone
178 Wardha Maharashtra Green Zone
179 Imphal West Manipur Green Zone
180 Thoubal Manipur Green Zone
181 Bishnupur Manipur Green Zone
182 Chandel Manipur Green Zone
183 Churachandpur Manipur Green Zone
184 Imphal East Manipur Green Zone
185 Senapati Manipur Green Zone
186 Tamenglong Manipur Green Zone
187 Ukhrul Manipur Green Zone
188 Kakching Manipur Green Zone
189 Kangpokpi Manipur Green Zone
190 Jiribam Manipur Green Zone
191 Nonev Manipur Green Zone
192 Pherzawl Manipur Green Zone
193 Tengnoupal Manipur Green Zone
194 Kamjong Manipur Green Zone
195 East Garo Hills Meghalaya Green Zone
196 West Jaintia Hills Meghalaya Green Zone
197 Ri Bhoi Meghalaya Green Zone
198 South Garo Hills Meghalaya Green Zone
199 West Garo Hills Meghalaya Green Zone
200 West Khasi Hills Meghalaya Green Zone
201 North Garo Hills Meghalaya Green Zone
202 East Jaintia Hills Meghalaya Green Zone
203 South West Khasi Hills Meghalaya Green Zone
204 South West Garo Hills Meghalaya Green Zone
205 Aizawl Mizoram Green Zone
206 Champhai Mizoram Green Zone
207 Kolasib Mizoram Green Zone
208 Lawngtlai Mizoram Green Zone
209 Lunglei Mizoram Green Zone
210 Mamit Mizoram Green Zone
211 Saiha Mizoram Green Zone
212 Serchhip Mizoram Green Zone
213 Hnahthial Mizoram Green Zone
214 Saitual Mizoram Green Zone
215 Khawzawl Mizoram Green Zone
216 Dimapur Nagaland Green Zone
217 Kohima Nagaland Green Zone
218 Mokokchung Nagaland Green Zone
219 Mon Nagaland Green Zone
220 Phek Nagaland Green Zone
221 Tuensang Nagaland Green Zone
222 Wokha Nagaland Green Zone
223 Zunheboto Nagaland Green Zone
224 Peren Nagaland Green Zone
225 Kiphire Nagaland Green Zone
226 Longleng Nagaland Green Zone
227 Cuttack Orrisa Green Zone
228 Puri Orrisa Green Zone
229 Anugul Orrisa Green Zone
230 Balangir Orrisa Green Zone
231 Bargarh Orrisa Green Zone
232 Boudh Orrisa Green Zone
233 Deogarh Orrisa Green Zone
234 Gajapati Orrisa Green Zone
235 Ganjam Orrisa Green Zone
236 Jagatsinghapu r Orrisa Green Zone
237 Jharsuguda Orrisa Green Zone
238 Kandhamal Orrisa Green Zone
239 Kendujhar Orrisa Green Zone
240 Malkangiri Orrisa Green Zone
241 Mayurbhanj Orrisa Green Zone
242 Nabarangpur Orrisa Green Zone
243 Nayagarh Orrisa Green Zone
244 Nuapada Orrisa Green Zone
245 Rayagada Orrisa Green Zone
246 Sambalpur Orrisa Green Zone
247 Sonepur Orrisa Green Zone
248 Karaikal Puducherry Green Zone
249 Mahe Puducherry Green Zone
250 Yanam Puducherry Green Zone
251 Rupnagar (Ropar) Punjab Green Zone
252 Fatehgarh Sahib Punjab Green Zone
253 Bathinda Punjab Green Zone
254 Fazilka Punjab Green Zone
255 Baran Rajasthan Green Zone
256 Bundi Rajasthan Green Zone
257 Ganganagar Rajasthan Green Zone
258 Jalore Rajasthan Green Zone
259 Sirohi Rajasthan Green Zone
260 Pratapgarh Rajasthan Green Zone
261 North District Sikkim Green Zone
262 East District Sikkim Green Zone
263 South District Sikkim Green Zone
264 West District Sikkim Green Zone
265 Krishnagiri Tamil Nadu Green Zone
266 Peddapalli Telangana Green Zone
267 Nagarkurnool Telangana Green Zone
268 Mulugu Telangana Green Zone
269 BhadradriKothagudem Telangana Green Zone
270 Mahabubabad Telangana Green Zone
271 Siddipet Telangana Green Zone
272 Warangal Rural Telangana Green Zone
273 Wanaparthy Telangana Green Zone
274 YadadriBhuvanagiri Telangana Green Zone
275 Dhalai Tripura Green Zone
276 South Tripura Tripura Green Zone
277 West Tripura Tripura Green Zone
278 Khowai Tripura Green Zone
279 Sepahijala Tripura Green Zone
280 Unakoti Tripura Green Zone
281 Barabanki Uttar Pradesh Green Zone
282 Kheri Uttar Pradesh Green Zone
283 Hathras Uttar Pradesh Green Zone
284 Maharajganj Uttar Pradesh Green Zone
285 Shahjahanpur Uttar Pradesh Green Zone
286 Ambedkar Nagar Uttar Pradesh Green Zone
287 BaIlia Uttar Pradesh Green Zone
288 Chandauli Uttar Pradesh Green Zone
289 Chitrakoot Uttar Pradesh Green Zone
290 Deoria Uttar Pradesh Green Zone
291 Farrukhabad Uttar Pradesh Green Zone
292 Fatehpur Uttar Pradesh Green Zone
293 Hamirpur Uttar Pradesh Green Zone
294 Kanpur Dehat Uttar Pradesh Green Zone
295 Kushi Nagar Uttar Pradesh Green Zone
296 Lalitpur Uttar Pradesh Green Zone
297 Mahoba Uttar Pradesh Green Zone
298 Siddharth Nagar Uttar Pradesh Green Zone
299 Sonbhadra Uttar Pradesh Green Zone
300 Amethi Uttar Pradesh Green Zone
301 Udam Singh Nagar Uttarakhand Green Zone
302 Almora Uttarakhand Green Zone
303 Pauri Garhwal Uttarakhand Green Zone
304 Bageshwar Uttarakhand Green Zone
305 Chamoli Uttarakhand Green Zone
306 Champawat Uttarakhand Green Zone
307 Pithoraga rh Uttarakhand Green Zone
308 RudraPrayag Uttarakhand Green Zone
309 Tehri Garhwal Uttarakhand Green Zone
310 Uttar Kashi Uttarakhand Green Zone
311 Dinajpur Uttar West Bengal Green Zone
312 Bankura West Bengal Green Zone
313 Birbhum West Bengal Green Zone
314 Coochbehar West Bengal Green Zone
315 Dinajpur Dakshin West Bengal Green Zone
316 Purulia West Bengal Green Zone
317 Alipurduar West Bengal Green Zone
318 Jhargram West Bengal Green Zone
zones_data = zones[['State','Zone','District']]
zones_data = zones_data.dropna()
fig = px.treemap(zones_data, path=['State','Zone','District'], color='Zone',
                 color_discrete_map={'(?)':'#6A6E68','Green Zone':'#00FF00', 'Red Zone':'#E12828', 'Orange Zone':'#C96800'},
                 hover_data=['Zone'])
fig.update_layout(margin=dict(l=0,r=0,b=0,t=0,pad=0),
                  paper_bgcolor="white",height= 600,
                  legend=dict(x=.825,y=.98),
                  font_size=20)
fig.show()

Prediction

Logistic curve is used to predict future behavior of the total number of confirmed cases

  • L (the maximum number of confirmed cases) = 250000 taken from the US example (this is from long time obsolete now)
  • k (growth rate) = 0.25 approximated value from most of the countries
  • x0 (the day of the inflexion) = 80 approximated

The curve being:

y=L/(1+e−k(x−x0))+1

import scipy

def logistic(x, L, k, x0):
    return L / (1 + np.exp(-k * (x - x0))) + 1

d_df = case_data.groupby('date').max().reset_index()[['date','confirmed']]

def plot_logistic_fit_data(d_df, title, p0):
    d_df = d_df.sort_values(by=['date'], ascending=True)
    d_df['x'] = np.arange(len(d_df)) + 1
    d_df['y'] = d_df['confirmed']

    x = d_df['x']
    y = d_df['y']

    c2 = scipy.optimize.curve_fit(logistic,  x,  y,  p0=p0 )
    #y = logistic(x, L, k, x0)
    popt, pcov = c2

    x = range(1,d_df.shape[0] + int(popt[2]))
    y_fit = logistic(x, *popt)
    
    p_df = pd.DataFrame()
    p_df['x'] = x
    p_df['y'] = y_fit.astype(int)

    print("Predicted L (the maximum number of confirmed cases): " + str(int(popt[0])))
    print("Predicted k (growth rate): " + str(float(popt[1])))
    print("Predicted x0 (the day of the inflexion): " + str(int(popt[2])) + "")

    x0 = int(popt[2])
    
    traceC = go.Scatter(x=d_df['x'], y=d_df['y'],name="Confirmed",marker=dict(color="Red"),
                        mode = "markers+lines",text=d_df['confirmed'],)

    traceP = go.Scatter(x=p_df['x'], y=p_df['y'],name="Predicted",marker=dict(color="blue"),
                        mode = "lines",text=p_df['y'],)

    trace_x0 = go.Scatter(x = [x0, x0], y = [0, p_df.loc[p_df['x']==x0,'y'].values[0]],
                         name = "X0 - Inflexion point",marker=dict(color="black"),
                         mode = "lines",text = "X0 - Inflexion point")

    data = [traceC, traceP, trace_x0]

    layout = dict(title = 'Cumulative Conformed cases and logistic curve projection',
          xaxis = dict(title = 'Day since first case', showticklabels=True), 
          yaxis = dict(title = 'Number of cases'),
          hovermode = 'x',plot_bgcolor='rgb(275, 270, 273)')
    
    fig = go.Figure(dict(data=data, layout=layout))
    fig.show()
    
L = 250000
k = 0.25
x0 = 100
p0 = (L, k, x0)
plot_logistic_fit_data(d_df, 'India',p0)
Predicted L (the maximum number of confirmed cases): 514328
Predicted k (growth rate): 0.04894639316085083
Predicted x0 (the day of the inflexion): 165

Fitting an exponential curve

The parameters for the curve are:

  • A - the constant multiplier for the exponential
  • B - the multiplier for the exponent

The curve is thus:

y=AeBx

import datetime
import scipy
p0 = (0,0)
def plot_exponential_fit_data(d_df, title, delta, p0):
    d_df = d_df.sort_values(by=['date'], ascending=True)
    d_df['x'] = np.arange(len(d_df)) + 1
    d_df['y'] = d_df['confirmed']

    x = d_df['x'][:-delta]
    y = d_df['y'][:-delta]

    c2 = scipy.optimize.curve_fit(lambda t,a,b: a*np.exp(b*t),  x,  y,  p0=p0)

    A, B = c2[0]
    print(f'(y = Ae^(Bx)) A: {A}, B: {B}')
    x = range(1,d_df.shape[0] + 1)
    y_fit = A * np.exp(B * x)
    
    traceC = go.Scatter( x=d_df['x'][:-delta], y=d_df['y'][:-delta],name="Confirmed (included for fit)",
                        marker=dict(color="Red"),mode = "markers+lines",text=d_df['confirmed'])

    traceV = go.Scatter(x=d_df['x'][-delta-1:], y=d_df['y'][-delta-1:],name="Confirmed (validation)",
                        marker=dict(color="blue"),mode = "markers+lines",text=d_df['confirmed'])
    
    traceP = go.Scatter(x=np.array(x), y=y_fit,name="Projected values (fit curve)",marker=dict(color="green"),
                        mode = "lines",text=y_fit,
    )

    data = [traceC, traceV, traceP]

    layout = dict(title = 'Cumulative Conformed cases and exponential curve projection',
          xaxis = dict(title = 'Day since first case', showticklabels=True), 
          yaxis = dict(title = 'Number of cases'),plot_bgcolor='rgb(275, 270, 273)',
          hovermode = 'x')

    fig = go.Figure(dict(data=data, layout=layout))
    fig.show()

p0 = (40, 0.2)
plot_exponential_fit_data(d_df, 'I', 7, p0)
(y = Ae^(Bx)) A: 420.86721919248686, B: 0.03985108560844086