|
|
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 2,
- "metadata": {},
- "outputs": [],
- "source": [
- "# Reading data\n",
- "import os\n",
- "import git\n",
- "import shutil\n",
- "import tempfile\n",
- "\n",
- "# Create temporary dir\n",
- "t = tempfile.mkdtemp()\n",
- "d = 'lwc/topics/covid19/covid-model'\n",
- "# Clone into temporary dir\n",
- "git.Repo.clone_from('http://gmarx.jumpingcrab.com:8088/COVID-19/covid19-data.git', \n",
- " t, branch='master', depth=1)\n",
- "# Delete files\n",
- "#os.remove('README.txt')\n",
- "shutil.rmtree('data')\n",
- "#shutil.rmtree('secondTest')\n",
- "# Copy desired file from temporary dir\n",
- "shutil.move(os.path.join(t, 'data'), '.')\n",
- "# Remove temporary dir\n",
- "shutil.rmtree(t)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [],
- "source": [
- "import pandas as pd\n",
- "import numpy as np\n",
- "import os\n",
- "def loadData(path, file):\n",
- " csvPath=os.path.join(path, file)\n",
- " return pd.read_csv(csvPath)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 5,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>Date</th>\n",
- " <th>Country/Region</th>\n",
- " <th>Province/State</th>\n",
- " <th>Lat</th>\n",
- " <th>Long</th>\n",
- " <th>Confirmed</th>\n",
- " <th>Recovered</th>\n",
- " <th>Deaths</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>2020-01-22</td>\n",
- " <td>Afghanistan</td>\n",
- " <td>NaN</td>\n",
- " <td>33.0</td>\n",
- " <td>65.0</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>2020-01-23</td>\n",
- " <td>Afghanistan</td>\n",
- " <td>NaN</td>\n",
- " <td>33.0</td>\n",
- " <td>65.0</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>2020-01-24</td>\n",
- " <td>Afghanistan</td>\n",
- " <td>NaN</td>\n",
- " <td>33.0</td>\n",
- " <td>65.0</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>2020-01-25</td>\n",
- " <td>Afghanistan</td>\n",
- " <td>NaN</td>\n",
- " <td>33.0</td>\n",
- " <td>65.0</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>2020-01-26</td>\n",
- " <td>Afghanistan</td>\n",
- " <td>NaN</td>\n",
- " <td>33.0</td>\n",
- " <td>65.0</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " Date Country/Region Province/State Lat Long Confirmed Recovered \\\n",
- "0 2020-01-22 Afghanistan NaN 33.0 65.0 0 0.0 \n",
- "1 2020-01-23 Afghanistan NaN 33.0 65.0 0 0.0 \n",
- "2 2020-01-24 Afghanistan NaN 33.0 65.0 0 0.0 \n",
- "3 2020-01-25 Afghanistan NaN 33.0 65.0 0 0.0 \n",
- "4 2020-01-26 Afghanistan NaN 33.0 65.0 0 0.0 \n",
- "\n",
- " Deaths \n",
- "0 0 \n",
- "1 0 \n",
- "2 0 \n",
- "3 0 \n",
- "4 0 "
- ]
- },
- "execution_count": 5,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "# import jtplot submodule from jupyterthemes\n",
- "from jupyterthemes import jtplot\n",
- "PATH=os.path.join(\"data\")\n",
- "covid_data=loadData(PATH,\"time-series-19-covid-combined.csv\")\n",
- "covid_data.head()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 7,
- "metadata": {},
- "outputs": [],
- "source": [
- "from sklearn.model_selection import train_test_split \n",
- "train_set, test_set=train_test_split(covid_data,test_size=0.2,random_state=42)\n",
- "train_cp=train_set.copy()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 8,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([[<matplotlib.axes._subplots.AxesSubplot object at 0x11e46ca50>,\n",
- " <matplotlib.axes._subplots.AxesSubplot object at 0x116caea90>],\n",
- " [<matplotlib.axes._subplots.AxesSubplot object at 0x11e65dd10>,\n",
- " <matplotlib.axes._subplots.AxesSubplot object at 0x11e6a16d0>],\n",
- " [<matplotlib.axes._subplots.AxesSubplot object at 0x11e6d3ed0>,\n",
- " <matplotlib.axes._subplots.AxesSubplot object at 0x11e716710>]],\n",
- " dtype=object)"
- ]
- },
- "execution_count": 8,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEICAYAAAC9E5gJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3deZRdZZnv8e/PMIhhSGKwDAlSoLQaxMsQAZe0Ny02hOHecG2loVkSEEi3wmptWd0G8YqNU7AbRQQF1EhQmcSBiCAGpByuJpLYSBiMKTBI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C5gX0l7S9oBOBFY0OaYzJrJdd5KpRTJICK2AGcDtwEPADdExH01rm7QU+o2amhcklZKenuVy/RIOqPCpFGxz8pklNR5qDG2Wup3DUbcfquHIqLV27QGkLQSOCMibq9imR7gGxHxlWbFZdYItdRvq08pzgysMSSNl3SzpCckPZ3Hp+RpnwT+GrhU0iZJl7Y3WrPqSToz36S3TtICSXsUpoWkf5K0QtJ6SZdJUp42RtJFkp6U9HtJZ+f5O6oTTTM5GYwsLwG+Ruo+9irgOeBSgIg4D/gZcHZE7BwRZ7ctSrMaSHob8GngBGAS8DDp/oyi44A3AW/M8x2Vy88k3eB3AHAQcHwLQu4oIyoZtOL2fkl7SrpT0v2S7pP0/lw+QdLCfFSyUNL4XC5Jl+SY7pF0UGFds/L8KyTNKpQfLGlZXuaSvqOboUTEU8D3gP8HXAt8EvgbSYsl9ZLudB2Tt7GjpOvzNhZL6i5s/9xcvlzSUYXymvavpHGSbpT0W0kPSHpzGfbXSNCKOt9ve02v/4M4GZgXEb+OiD8C5wJvLtZdYC7wDHAT8AJwgKS9gQt
- "text/plain": [
- "<Figure size 432x288 with 6 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "%matplotlib inline\n",
- "covid_data.hist()\n"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 52,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "(63, 8)"
- ]
- },
- "execution_count": 52,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "%matplotlib inline \n",
- "import matplotlib.pyplot as plt \n",
- "covid_mexico = covid_data[covid_data['Country/Region']=='Mexico']\n",
- "covid_mexico.shape"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 134,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "<matplotlib.axes._subplots.AxesSubplot at 0x12b7c9910>"
- ]
- },
- "execution_count": 134,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYcAAAEGCAYAAACO8lkDAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAcJUlEQVR4nO3dfaxlVXnH8e+jFI31BZDbCTKMQy011foGt0SLsVbwDUwHW2tIjOJLMm2qRqMWBk1am7bJqK1WbWuCqB0rFvGtThGr0trW1IDcoai8SBxxRmYywCCKWhIt+vSPsy8c7jn7nP2+Xvbvk9zM3H3OPWftfc5ez15rPWttc3dERESmPSB0AUREJD4KDiIiMkPBQUREZig4iIjIDAUHERGZcUToAnTh2GOP9a1bt4YuhohIUvbs2XOHu6/MeyyL4LB161bW1tZCF0NEJClmtr/sMXUriYjIDAUHERGZoeAgIiIzFBxERGSGgoOIiMzIIltJwtq647P3/n/fzrMClkREuqKWg7QyHRjm/S4iaVJwkMbKAoEChEj6FBxERGSGgoOIiMxQcJDGygafNSgtkj4FB2llYyBQYBDJg1JZpTUFBJH8qOUgIiIzFBxERGSGgoOIiMxQcBARkRkakJboae0mkeGp5SBR09pNImEoOEi0Ul67aeuOz977I5IiBQeRGqpU+mrtSA4UHEQqqlLpp9zaEZmm4CDRarp2Ux9dOqr0ZWwUHCRqddduUpeOSDcUHCR6+3aede/PIjFc3WulWsmFgoPIlLIuqTqVvlaqlRwEnQRnZkcBFwG/DjjwSuAm4GPAVmAf8GJ3/36gIsqIzOuSmq7Y9+08q/KEPAUETV5Mnbl7uDc32wV82d0vMrMjgYcAbwbudPedZrYDONrdz1/0Oqurq762tjZAiSV287qQqlRMi7qeVLHV1/RzkGGZ2R53X533WLBuJTN7BPAM4AMA7v5Td/8BsA3YVTxtF3B2mBJKimLo0hn7BLgYxn6kvZD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KDpnTHIt0zWvFdFFRxhggxtb9mQIFhxEYyxyLHAPhdCumy2yqPlpGOR7/MVNwGImxDOilEAiXlalq3n2T1+7DdGsmxPGv+h4xfhdiplRWGaUYctjrpBj3mYLaJtV50d8OMZ+haotKgWE+zXMQmZLivI++5yf0PaO86utuLEeXqbAyS8FBpJDyvTViC2pNr/T7fo8u3ncsFgWHkPeQFklSqBv7zLuSXv89x8pPgSEsDUiL1NBkBnCXs4bLkgpCpHz2WekqMISn4JCo3G8M05c26ZZNcvGHuFlQF6/Z1LzspCbHWN/n+Cg4JCi29XRSk0K6a1OhAsTGoFDnGPexHpa0pzGHjvWdIrnoqlEnSnUpHasY0m770vegts6L5tRy6JCu6PPWpLuk6zvTVansYvjedXEuLJrzsWji3bKySDUKDh2JqR9Y+tOkS6ppN1abVmLI793Q50LsxyNV6lZKSMo5+jlpcqz7uidE6pVe2T40mQ+Rw/GIiVoOiVBgkFzlnCCQMs2Q7lBfM1gVGMKIYSC4yndqqO9HnePR5blQN3sptpnkMYvyNqFmdoKZfcnMbjCz683sdcX2Y8zsi2b2reLfo0OVsS5dAeUjluSCKt+pOmmiTdU9Hl2eC3X/VudhN4K1HMzsOOA4d7/GzB4G7AHOBl4O3OnuO81sB3C0u5+/6LViaTn0RS2HYaV6vPsqd2wtk1Q/nxhF2XJw90Pufk3x/x8BNwLHA9uAXcXTdjEJGKNWNR1Ss0wlVVVaJsu+2woM3YpiQNrMtgJPAa4CNrn7oeKhW4FNgYoVjSb9zgoSkooqqa91u7GkveAD0mb2UOA/gb9090+Z2Q/c/aipx7/v7jPjDma2HdgOsGXLllP2798/WJmH1EU
- "text/plain": [
- "<Figure size 432x288 with 1 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "covid_data.plot(kind=\"scatter\", x=\"Long\", y=\"Lat\")"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 98,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>Date</th>\n",
- " <th>Country/Region</th>\n",
- " <th>Province/State</th>\n",
- " <th>Lat</th>\n",
- " <th>Long</th>\n",
- " <th>Confirmed</th>\n",
- " <th>Recovered</th>\n",
- " <th>Deaths</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>9954</th>\n",
- " <td>2020-01-22</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9955</th>\n",
- " <td>2020-01-23</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9956</th>\n",
- " <td>2020-01-24</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9957</th>\n",
- " <td>2020-01-25</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9958</th>\n",
- " <td>2020-01-26</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>0</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>...</th>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10012</th>\n",
- " <td>2020-03-20</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>164</td>\n",
- " <td>4.0</td>\n",
- " <td>1</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10013</th>\n",
- " <td>2020-03-21</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>203</td>\n",
- " <td>4.0</td>\n",
- " <td>2</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10014</th>\n",
- " <td>2020-03-22</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>251</td>\n",
- " <td>4.0</td>\n",
- " <td>2</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10015</th>\n",
- " <td>2020-03-23</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>316</td>\n",
- " <td>4.0</td>\n",
- " <td>3</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10016</th>\n",
- " <td>2020-03-24</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>367</td>\n",
- " <td>NaN</td>\n",
- " <td>4</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>63 rows × 8 columns</p>\n",
- "</div>"
- ],
- "text/plain": [
- " Date Country/Region Province/State Lat Long Confirmed \\\n",
- "9954 2020-01-22 Mexico NaN 23.6345 -102.5528 0 \n",
- "9955 2020-01-23 Mexico NaN 23.6345 -102.5528 0 \n",
- "9956 2020-01-24 Mexico NaN 23.6345 -102.5528 0 \n",
- "9957 2020-01-25 Mexico NaN 23.6345 -102.5528 0 \n",
- "9958 2020-01-26 Mexico NaN 23.6345 -102.5528 0 \n",
- "... ... ... ... ... ... ... \n",
- "10012 2020-03-20 Mexico NaN 23.6345 -102.5528 164 \n",
- "10013 2020-03-21 Mexico NaN 23.6345 -102.5528 203 \n",
- "10014 2020-03-22 Mexico NaN 23.6345 -102.5528 251 \n",
- "10015 2020-03-23 Mexico NaN 23.6345 -102.5528 316 \n",
- "10016 2020-03-24 Mexico NaN 23.6345 -102.5528 367 \n",
- "\n",
- " Recovered Deaths \n",
- "9954 0.0 0 \n",
- "9955 0.0 0 \n",
- "9956 0.0 0 \n",
- "9957 0.0 0 \n",
- "9958 0.0 0 \n",
- "... ... ... \n",
- "10012 4.0 1 \n",
- "10013 4.0 2 \n",
- "10014 4.0 2 \n",
- "10015 4.0 3 \n",
- "10016 NaN 4 \n",
- "\n",
- "[63 rows x 8 columns]"
- ]
- },
- "execution_count": 98,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "from datetime import datetime\n",
- "#covid_mexico['Date'] =pd.to_datetime(covid_mexico.Date, format=\"%Y-%m-%d\")\n",
- "mexico_sort=covid_mexico.sort_values(by='Date', ascending=True)\n",
- "mexico_sort"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 100,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/html": [
- "<div>\n",
- "<style scoped>\n",
- " .dataframe tbody tr th:only-of-type {\n",
- " vertical-align: middle;\n",
- " }\n",
- "\n",
- " .dataframe tbody tr th {\n",
- " vertical-align: top;\n",
- " }\n",
- "\n",
- " .dataframe thead th {\n",
- " text-align: right;\n",
- " }\n",
- "</style>\n",
- "<table border=\"1\" class=\"dataframe\">\n",
- " <thead>\n",
- " <tr style=\"text-align: right;\">\n",
- " <th></th>\n",
- " <th>Date</th>\n",
- " <th>Country/Region</th>\n",
- " <th>Province/State</th>\n",
- " <th>Lat</th>\n",
- " <th>Long</th>\n",
- " <th>Confirmed</th>\n",
- " <th>Recovered</th>\n",
- " <th>Deaths</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>9991</th>\n",
- " <td>2020-02-28</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>1</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9992</th>\n",
- " <td>2020-02-29</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>4</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9993</th>\n",
- " <td>2020-03-01</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>5</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9994</th>\n",
- " <td>2020-03-02</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>5</td>\n",
- " <td>0.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9995</th>\n",
- " <td>2020-03-03</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>5</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9996</th>\n",
- " <td>2020-03-04</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>5</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9997</th>\n",
- " <td>2020-03-05</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>5</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9998</th>\n",
- " <td>2020-03-06</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>6</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9999</th>\n",
- " <td>2020-03-07</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>6</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10000</th>\n",
- " <td>2020-03-08</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>7</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10001</th>\n",
- " <td>2020-03-09</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>7</td>\n",
- " <td>1.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10002</th>\n",
- " <td>2020-03-10</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>7</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10003</th>\n",
- " <td>2020-03-11</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>8</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10004</th>\n",
- " <td>2020-03-12</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>12</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10005</th>\n",
- " <td>2020-03-13</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>12</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10006</th>\n",
- " <td>2020-03-14</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>26</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10007</th>\n",
- " <td>2020-03-15</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>41</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10008</th>\n",
- " <td>2020-03-16</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>53</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10009</th>\n",
- " <td>2020-03-17</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>82</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10010</th>\n",
- " <td>2020-03-18</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>93</td>\n",
- " <td>4.0</td>\n",
- " <td>0</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10011</th>\n",
- " <td>2020-03-19</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>118</td>\n",
- " <td>4.0</td>\n",
- " <td>1</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10012</th>\n",
- " <td>2020-03-20</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>164</td>\n",
- " <td>4.0</td>\n",
- " <td>1</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10013</th>\n",
- " <td>2020-03-21</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>203</td>\n",
- " <td>4.0</td>\n",
- " <td>2</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10014</th>\n",
- " <td>2020-03-22</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>251</td>\n",
- " <td>4.0</td>\n",
- " <td>2</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10015</th>\n",
- " <td>2020-03-23</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>316</td>\n",
- " <td>4.0</td>\n",
- " <td>3</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10016</th>\n",
- " <td>2020-03-24</td>\n",
- " <td>Mexico</td>\n",
- " <td>NaN</td>\n",
- " <td>23.6345</td>\n",
- " <td>-102.5528</td>\n",
- " <td>367</td>\n",
- " <td>NaN</td>\n",
- " <td>4</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " Date Country/Region Province/State Lat Long Confirmed \\\n",
- "9991 2020-02-28 Mexico NaN 23.6345 -102.5528 1 \n",
- "9992 2020-02-29 Mexico NaN 23.6345 -102.5528 4 \n",
- "9993 2020-03-01 Mexico NaN 23.6345 -102.5528 5 \n",
- "9994 2020-03-02 Mexico NaN 23.6345 -102.5528 5 \n",
- "9995 2020-03-03 Mexico NaN 23.6345 -102.5528 5 \n",
- "9996 2020-03-04 Mexico NaN 23.6345 -102.5528 5 \n",
- "9997 2020-03-05 Mexico NaN 23.6345 -102.5528 5 \n",
- "9998 2020-03-06 Mexico NaN 23.6345 -102.5528 6 \n",
- "9999 2020-03-07 Mexico NaN 23.6345 -102.5528 6 \n",
- "10000 2020-03-08 Mexico NaN 23.6345 -102.5528 7 \n",
- "10001 2020-03-09 Mexico NaN 23.6345 -102.5528 7 \n",
- "10002 2020-03-10 Mexico NaN 23.6345 -102.5528 7 \n",
- "10003 2020-03-11 Mexico NaN 23.6345 -102.5528 8 \n",
- "10004 2020-03-12 Mexico NaN 23.6345 -102.5528 12 \n",
- "10005 2020-03-13 Mexico NaN 23.6345 -102.5528 12 \n",
- "10006 2020-03-14 Mexico NaN 23.6345 -102.5528 26 \n",
- "10007 2020-03-15 Mexico NaN 23.6345 -102.5528 41 \n",
- "10008 2020-03-16 Mexico NaN 23.6345 -102.5528 53 \n",
- "10009 2020-03-17 Mexico NaN 23.6345 -102.5528 82 \n",
- "10010 2020-03-18 Mexico NaN 23.6345 -102.5528 93 \n",
- "10011 2020-03-19 Mexico NaN 23.6345 -102.5528 118 \n",
- "10012 2020-03-20 Mexico NaN 23.6345 -102.5528 164 \n",
- "10013 2020-03-21 Mexico NaN 23.6345 -102.5528 203 \n",
- "10014 2020-03-22 Mexico NaN 23.6345 -102.5528 251 \n",
- "10015 2020-03-23 Mexico NaN 23.6345 -102.5528 316 \n",
- "10016 2020-03-24 Mexico NaN 23.6345 -102.5528 367 \n",
- "\n",
- " Recovered Deaths \n",
- "9991 0.0 0 \n",
- "9992 0.0 0 \n",
- "9993 0.0 0 \n",
- "9994 0.0 0 \n",
- "9995 1.0 0 \n",
- "9996 1.0 0 \n",
- "9997 1.0 0 \n",
- "9998 1.0 0 \n",
- "9999 1.0 0 \n",
- "10000 1.0 0 \n",
- "10001 1.0 0 \n",
- "10002 4.0 0 \n",
- "10003 4.0 0 \n",
- "10004 4.0 0 \n",
- "10005 4.0 0 \n",
- "10006 4.0 0 \n",
- "10007 4.0 0 \n",
- "10008 4.0 0 \n",
- "10009 4.0 0 \n",
- "10010 4.0 0 \n",
- "10011 4.0 1 \n",
- "10012 4.0 1 \n",
- "10013 4.0 2 \n",
- "10014 4.0 2 \n",
- "10015 4.0 3 \n",
- "10016 NaN 4 "
- ]
- },
- "execution_count": 100,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "mexico_filter = mexico_sort[mexico_sort['Confirmed']!=0]\n",
- "mexico_filter"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 118,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,\n",
- " 18, 19, 20, 21, 22, 23, 24, 25, 26])"
- ]
- },
- "execution_count": 118,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "n=mexico_filter.shape[0]\n",
- "days=np.arange(1,n+1,1)\n",
- "days"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 119,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "<matplotlib.collections.PathCollection at 0x12acc8290>"
- ]
- },
- "execution_count": 119,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD4CAYAAAAXUaZHAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAUZUlEQVR4nO3df4xd5Z3f8fdnXW92lKw6UEbIHtyaptSrbKK10ZRkRbSipFkDrYQTbRGplKURrVMJ1ERaWYvzT9iqEW69CVWkFokIGqdKw6KN11gbWi8FpDSRAjtggvlRN25ChAcHzy5xAsqUgvPtH3NMBmd+3Dtz79w7Z94vaTTnfs859z5Hx/7Mmec8c55UFZKkdvmVQTdAktR7hrsktZDhLkktZLhLUgsZ7pLUQn9j0A0AuOiii2rr1q2DboYkrSlPPPHEX1XV2HzrhiLct27dyuTk5KCbIUlrSpIfLrTObhlJaiHDXZJayHCXpBYy3CWphQx3SWqhoRgtI0nrzaGjU+w/cpyXzsyweXSEPTu3sWvHeM/e33CXpFV26OgUew8eY+aNswBMnZlh78FjAD0LeLtlJGmV7T9y/K1gP2fmjbPsP3K8Z59huEvSKnvpzExX9eUw3CVplW0eHemqvhyGuyStsj07tzGyccPbaiMbN7Bn57aefYY3VCVplZ27aepoGUlqmV07xnsa5uezW0aSWmjJcE/ya0keT/LdJM8m+aOm/uUkP0jyVPO1vaknyReTnEjydJLL+30QkqS366Rb5nXg6qp6LclG4FtJ/luzbk9V/el5218LXNZ8vR+4q/kuSVolS16516zXmpcbm69aZJfrga80+30HGE2yaeVNlSR1q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>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "#mexico_filter = mexico_sort[mexico_sort['Confirmed']!=0]\n",
- "plt.scatter(x=days, y=mexico_filter['Confirmed'])"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 127,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 132,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "array([ 1.07768657, 0.22640743, -3.90363561])"
- ]
- },
- "execution_count": 132,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "from scipy.optimize import curve_fit\n",
- "def exponential(x, a,k, b):\n",
- " return a*np.exp(x*k) + b\n",
- "\n",
- "potp, pcov = curve_fit(exponential, days, mexico_filter['Confirmed'])\n",
- "potp"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 122,
- "metadata": {},
- "outputs": [],
- "source": []
- },
- {
- "cell_type": "code",
- "execution_count": 133,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[<matplotlib.lines.Line2D at 0x12b888fd0>]"
- ]
- },
- "execution_count": 133,
- "metadata": {},
- "output_type": "execute_result"
- },
- {
- "data": {
- "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXcAAAD7CAYAAACRxdTpAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4xLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy8QZhcZAAAgAElEQVR4nO3de3wV9Z3/8dcnIVwCKqApIORCvVStdalG1C5br1y8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306wfnnx91ZIlLZA7VBuAqd3/FzPYAlpjZwnDfLHe/Of5gMzuEYN7ULwL7As+a2YHu3pjMwEVEUiEWi1FaWkpdXR0Aa9ceD2QxblwNeXkF0QbXCR3eubv7Ond/JSxvAVYCo9s5ZSow3923u/u7wCpamWtVRCQdlZWVfZbYA8ET1Orq/4omoC7qVJu7mRURTJb9Ylh1uZktM7M5ZjYsrBsNrI47bQ3t/zEQEUkbNTU1cVtHAQcD71NbOy+iiLom4eRuZkOAh4Er3X0zcBewHzAOWAf8rDNfbGalZlZpZpW1tbWdOVVEJGUKCuKbXi4O17+hsLB33aMmlNzNLIcgscfc/REAd1/v7o3u3gTMZmfTy1ogP+70MWFdC+5e4e7F7l6cl5fXnWsQEUma8vJycnNzgUEEjw9h4MD5lJeXRxpXZ3X4QNXMDLgbWOnut8TVj3L3deHmWcDysLwAuN/MbiF4oHoA8FJSoxYRSZGSkhIArrjiZT78cE/691/Kr3/9vc/qe4tEesv8I/BN4DUzWxrWXQucZ2bjAAeqgG8BuPvrZvYgsIKgp81l6ikjIr3JN75Rwh13lPD
- "text/plain": [
- "<Figure size 432x288 with 1 Axes>"
- ]
- },
- "metadata": {
- "needs_background": "light"
- },
- "output_type": "display_data"
- }
- ],
- "source": [
- "# Plot outputs\n",
- "plt.scatter(days, mexico_filter['Confirmed'], color='black')\n",
- "plt.plot(days,exponential(days,*potp), color='blue', linewidth=2)"
- ]
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.7.7"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 4
- }
|