<jupyter_start><jupyter_text>COVID-19 India Dashboard (Live)**Data Source**: API from covid19india.orgMinimal view of the daily COVID-19 cases in India in the last 100 days<jupyter_code>from datetime import datetime

import pandas as pd
import numpy as np

# For making web-requests to the website
import requests
import json

import matplotlib.pyplot as plt
import matplotlib.dates as mdates
import matplotlib as mpl
%matplotlib inline

from IPython.core.display import display,HTML

latest_df = pd.read_csv("https://api.covid19india.org/csv/latest/state_wise_daily.csv")
# print(latest_df.head())

# Confirmed Cases
df_confirmed = latest_df[(latest_df.Status == "Confirmed")]
df_confirmed = df_confirmed.drop(columns = ["Status"])

# Deaths
df_death = latest_df[(latest_df.Status == "Deceased")]
df_death = df_death.drop(columns = ["Status"])

df_confirmed["Date"] = df_confirmed["Date"].astype('datetime64[ns]')
# print(df_confirmed.head())

# Latest date
update = latest_df.iloc[-1,0]

# Total confirmed cases
cases = df_confirmed.TT.sum()

# Daily new cases
new_cases = df_confirmed.iloc[-1,2]

# Total deaths
deaths = df_death.TT.sum()

# Daily new deaths
new_deaths = df_death.iloc[-1,2]

# Last Updated at
c_time = datetime.now().time() # time object

# Display in HTML
overview = '''
<!-- #######  HTML!! #########-->
<h1 style="color: #ff8c00; text-align: center;">India COVID-19 Status</h1>
<p style="text-align: center;">Last update: <strong>{update}</strong></p>
<p style="color: #000080; text-align: center;"><strong>Confirmed cases:</strong></p>
<p style="text-align: center;font-size:24px;">{cases} (<span style="color: #ff0000;">+{new_cases}</span>)</p>
<p style="color: #006400; text-align: center;"><strong>Confirmed deaths:</strong></p>
<p style="text-align: center;font-size:24px;">{deaths} (<span style="color: #ff0000;">+{new_deaths}</span>)</p>
<p style="text-align: center;"><i>Last Updated: {c_time}<i></p>
'''

html = HTML(overview.format(update=update,cases=cases,new_cases=new_cases,deaths=deaths,new_deaths=new_deaths,c_time=c_time))
display(html)
#collapse

# For 10 states
n = 10

st = ["TT", "MH", "DL", "UP", "TN", "KA", "KL", "BR", "WB", "AP"]
state_name = ["India", "Maharashta", "Delhi", "Uttar Pradesh", "Tamil Nadu", "Karnataka", "Kerala", "Bihar", "West Bengal", "Andhra Pradesh"]

fig = plt.figure(figsize = (16,30))
gridspec = fig.add_gridspec(n, 3)

size = df_confirmed.shape[0]
df_confirmed.set_index(pd.Index(list(range(size))), inplace = True)

# Displaying the latest 100 days info
df_100 = df_confirmed.loc[size-100:size]

for i in range(n):
    ax = fig.add_subplot(gridspec[i, :])
    ax.bar(df_100.Date,df_100[st[i]],alpha=0.3,color='#007acc')
    ax.plot(df_100.Date,df_100[st[i]],marker="o",color='#007acc')
    ax.xaxis.set_major_locator(mdates.WeekdayLocator())
    ax.xaxis.set_major_formatter(mdates.DateFormatter('%b %d'))
    ax.text(0.02, 0.9,state_name[i], transform = ax.transAxes, fontsize=25)
    ax.spines['right'].set_visible(False)
    ax.spines['top'].set_visible(False)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.181877444589309, 'fraction_numerical': 0.03129074315514994, 'mean_word_length': 6.238207547169812, 'pattern_counts': {'":': 0, '<': 32, '<?xml version=': 0, '>': 32, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '445732', 'license': 'MIT', 'n_tokens_mistral': 1241, 'n_tokens_neox': 1131, 'n_words': 229, 'path': 'dashboards/covid-19-dashboard.ipynb', 'repo_name': 'anilgeorge04/eda-notes', 'size': '3068'}