<jupyter_start><jupyter_text>2019 nCov Tracking 1. Data Sources 1.1 Singapore- **Ministry of Health**: https://www.moh.gov.sg/2019-ncov-wuhan 1.2 Worldwide- **<NAME>**: https://gisanddata.maps.arcgis.com/apps/opsdashboard/index.html/bda7594740fd40299423467b48e9ecf6 1.3 Libraries & Dependencies<jupyter_code>import matplotlib
import matplotlib.pyplot as plt
import pandas as pd
import requests<jupyter_output><empty_output><jupyter_text>2. Data 2.1 Singapore Data<jupyter_code>%%writefile data/singapore.csv
Date,Cases,URL
23 Jan 2020,  1, https://www.moh.gov.sg/news-highlights/details/confirmed-imported-case-of-novel-coronavirus-infection-in-singapore-multi-ministry-taskforce-ramps-up-precautionary-measures
24 Jan 2020,  3, https://www.moh.gov.sg/news-highlights/details/two-more-cases-of-confirmed-imported-case-of-novel-coronavirus-infection-in-singapore
26 Jan 2020,  4, https://www.moh.gov.sg/news-highlights/details/fourth-confirmed-imported-case-of-wuhan-coronavirus-infection-in-singapore
27 Jan 2020,  5, https://www.moh.gov.sg/news-highlights/details/fifth-confirmed-imported-case-of-wuhan-coronavirus-infection-in-singapore-27Jan
28 Jan 2020,  7, https://www.channelnewsasia.com/news/singapore/wuhan-virus-singapore-latest-confirmed-cases-coronavirus-12360924
29 Jan 2020, 10, https://www.moh.gov.sg/news-highlights/details/three-more-confirmed-imported-cases-of-wuhan-coronavirus-infection-in-singapore
30 Jan 2020, 13, https://www.moh.gov.sg/news-highlights/details/three-more-confirmed-imported-cases-of-wuhan-coronavirus-infection-in-singapore-30Jan
31 Jan 2020, 16, https://www.moh.gov.sg/news-highlights/details/three-more-confirmed-imported-cases-of-wuhan-coronavirus-infection-in-singapore-31-jan
 1 Feb 2020, 18, https://www.moh.gov.sg/news-highlights/details/two-more-confirmed-imported-cases-of-novel-coronavirus-infection-in-singapore
 2 Feb 2020, 18, https://www.moh.gov.sg/news-highlights/details/no-new-confirmed-cases-of-novel-coronavirus-infection-in-singapore
 3 Feb 2020, 18, https://www.moh.gov.sg/news-highlights/details/no-new-confirmed-cases-of-novel-coronavirus-infection-in-singapore-3-Feb
 4 Feb 2020, 24, https://www.moh.gov.sg/news-highlights/details/confirmed-cases-of-local-transmission-of-novel-coronavirus-infection-in-singapore
 5 Feb 2020, 28, https://www.moh.gov.sg/news-highlights/details/four-more-confirmed-cases-of-novel-coronavirus-infection-in-singapore
 6 Feb 2020, 30, https://www.moh.gov.sg/news-highlights/details/two-more-confirmed-cases-of-novel-coronavirus-infection-in-singapore
 7 Feb 2020, 33, https://www.moh.gov.sg/news-highlights/details/three-more-confirmed-cases-of-novel-coronavirus-infection-in-singapore
 8 Feb 2020, 40, https://www.moh.gov.sg/news-highlights/details/seven-more-confirmed-cases-of-novel-coronavirus-infection-in-singapore
 9 Feb 2020, 43, https://www.moh.gov.sg/news-highlights/details/four-more-cases-discharged-three-new-confirmed-cases-of-novel-coronavirus-infection
10 Feb 2020, 45, https://www.moh.gov.sg/news-highlights/details/one-more-case-discharged-two-new-cases-of-novel-coronavirus-infection-confirmed-10feb
11 Feb 2020, 47, https://www.moh.gov.sg/news-highlights/details/two-more-cases-discharged-two-new-cases-of-novel-coronavirus-infection-confirmed
url = 'https://www.moh.gov.sg/2019-ncov-wuhan'
dfs = pd.read_html(url, index_col=0)
for df in dfs:
    display(df.T)<jupyter_output><empty_output><jupyter_text>2.2 Worldwide Data<jupyter_code>%%writefile data/worldwide.csv
Date,Mainland China,Other Locations
20 Jan 2020,   278,   4
21 Jan 2020,   326,   6
22 Jan 2020,   547,   8
23 Jan 2020,   639,  14
24 Jan 2020,   916,  25
25 Jan 2020,  2000,  40
26 Jan 2020,  2700,  57
27 Jan 2020,  4400,  64
28 Jan 2020,  6000,  87
29 Jan 2020,  7700, 105
30 Jan 2020,  9700, 118
31 Jan 2020, 11200, 153
 1 Feb 2020, 14300, 173
 2 Feb 2020, 17200, 183
 3 Feb 2020, 19700, 188
 4 Feb 2020, 23700, 212
 5 Feb 2020, 27400, 227
 6 Feb 2020, 30600, 265
 7 Feb 2020, 34100, 317
 8 Feb 2020, 36800, 343
 9 Feb 2020, 39800, 361
10 Feb 2020, 42300, 457
11 Feb 2020, 44300, 476<jupyter_output>Overwriting data/worldwide.csv<jupyter_text>3. Data Preprocessing<jupyter_code>dfsg = pd.read_csv('data/singapore.csv')
dfsg['Date'] = pd.to_datetime(dfsg['Date'], dayfirst=True)
dfsg.head()
dfw = pd.read_csv('data/worldwide.csv')
dfw['Date'] = pd.to_datetime(dfw['Date'], dayfirst=True)
dfw['Total'] = dfw['Mainland China'] + dfw['Other Locations']
dfw<jupyter_output><empty_output><jupyter_text>4. Plots<jupyter_code>fig, ax = plt.subplots(3, 1, sharex=True, figsize=(7,12))
dfw.plot(x='Date', y='Mainland China', marker='o', ax=ax[0]);
dfw.plot(x='Date', y='Other Locations', marker='o', ax=ax[1]);
dfsg.plot(x='Date', y='Cases', marker='o', ax=ax[2], label='Singapore');
plt.savefig('2019ncov-trends.png')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1516282928852935, 'fraction_numerical': 0.10392034847542003, 'mean_word_length': 5.0654088050314465, 'pattern_counts': {'":': 0, '<': 21, '<?xml version=': 0, '>': 21, 'https://': 22, 'lorem ipsum': 0, 'www.': 21, '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': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '293670', 'license': 'MIT', 'n_tokens_mistral': 2283, 'n_tokens_neox': 1828, 'n_words': 303, 'path': 'jupyter/01-data.ipynb', 'repo_name': 'nathanielng/2019ncov', 'size': '4827'}