{ "cells": [ { "cell_type": "code", "execution_count": 4, "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('firstTest')\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": 6, "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": 10, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DateCountry/RegionProvince/StateLatLongConfirmedRecoveredDeaths
02020-01-22AfghanistanNaN33.065.000.00
12020-01-23AfghanistanNaN33.065.000.00
22020-01-24AfghanistanNaN33.065.000.00
32020-01-25AfghanistanNaN33.065.000.00
42020-01-26AfghanistanNaN33.065.000.00
\n", "
" ], "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": 10, "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": 151, "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": 11, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "array([[,\n", " ],\n", " [,\n", " ],\n", " [,\n", " ]],\n", " dtype=object)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYMAAAEICAYAAAC9E5gJAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAgAElEQVR4nO3deZRdZZnv8e+PGcOQhGAZEqRAaXtFaREixOWUVgwQ7Q59G2lorgQccICrtvTSINpwBRRttRFBBjUCigyCCiIaAlKNXpshcSAMxhQQJCEQICEQQDH63D/e98BO5dRw5n2qfp+19qp93j09Z9e7z7P3uydFBGZmNrZt1ukAzMys85wMzMzMycDMzJwMzMwMJwMzM8PJwMzMcDLoapK2lfQjSeskfU/SkZKu72A8yyUd0Kn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+Ai4D35v6tgPFlX8fu3HVLN5qODDr2SIuIWBURv8r9TwH3kO6qnkP6ASP/PST3zwEujuQWYLykycCBwMKIWBMRa4GFwEF52A4RcUtEBHBxYV51kTQVeDvwjfxZwFuAKweJt/I9rgTemsefA1wWEX+KiPuBftL/oen/C0k7Am8CvgkQEc9FxBOUeB2bdZPRlAyqPdJiSruDyE0orwFuBXoiYlUe9DDQk/sHi3Wo8hVVyhtxJvBx4K/5807AExGxocoyno8rD1+Xx6/1ezRid+BR4Fu5aesbksZR7nVs1jVGUzLoOEnbAVcBH42IJ4vD8t5mKa7jlfQOYHVELO50LDXYAtgHODciXgM8TWoWel6Z1rFZtxlNyaCjj7SQtCUpEVwSEd/PxY/k5gfy39XDxDpU+dQq5fV6PfCPkpaTmnDeAnyF1JRSuRGxuIzn48rDdwQer+N7NGIFsCIibs2fryQlh7KuY7OuMpqSQcceaZHbz78J3BMRXy4MugaoXK0yF7i6UH5UvuJlBrAuN3UsAGZJmpCvipkFLMjDnpQ0Iy/rqMK8ahYRJ0bE1IjoJa2nn0XEkcBNwKGDxFv5Hofm8SOXH56vNtod2JN0Erbp/4uIeBh4UNIrctFbgbsp6To26zqdPoPdzI50BcnvSVeynNTG5b6B1DxxB/Cb3M0mtavfCCwDbgAm5vFFepnPvcASYHphXu8mnYjtB44plE8H7szTnE2+e7wJsc/khauJ9iD9mPcD3wO2zuXb5M/9efgehelPyjEtpXD1TSv+F8DewKK8nn9Iuhqo9OvYnbtu6Pw4CjMzG1XNRGZmVicnAzMzczIwMzMnAzMzw8nAzMxwMjAzM5wMzMwM+P+/sEgS1QeyNwAAAABJRU5ErkJggg==\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "%matplotlib inline\n", "covid_data.hist()\n" ] }, { "cell_type": "code", "execution_count": 153, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "(77, 8)" ] }, "execution_count": 153, "metadata": {}, "output_type": "execute_result" } ], "source": [ "%matplotlib inline \n", "import matplotlib.pyplot as plt \n", "covid_mexico = covid_data[covid_data['GeoId']=='MX']\n", "covid_mexico.shape" ] }, { "cell_type": "code", "execution_count": 21, "metadata": {}, "outputs": [ { "ename": "ImportError", "evalue": "The descartes package is required for plotting polygons in geopandas. You can install it using 'conda install -c conda-forge descartes' or 'pip install descartes'.", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mModuleNotFoundError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/geopandas/plotting.py\u001b[0m in \u001b[0;36mplot_polygon_collection\u001b[0;34m(ax, geoms, values, color, cmap, vmin, vmax, **kwargs)\u001b[0m\n\u001b[1;32m 80\u001b[0m \u001b[0;32mtry\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m---> 81\u001b[0;31m \u001b[0;32mfrom\u001b[0m \u001b[0mdescartes\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mpatch\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mPolygonPatch\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 82\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mImportError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mModuleNotFoundError\u001b[0m: No module named 'descartes'", "\nDuring handling of the above exception, another exception occurred:\n", "\u001b[0;31mImportError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0;32mimport\u001b[0m \u001b[0mgeopandas\u001b[0m \u001b[0;32mas\u001b[0m \u001b[0mgpd\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0mworld\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mgpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mread_file\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mgpd\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mdatasets\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mget_path\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'naturalearth_lowres'\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mworld\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mplot\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/geopandas/geodataframe.py\u001b[0m in \u001b[0;36mplot\u001b[0;34m(self, *args, **kwargs)\u001b[0m\n\u001b[1;32m 654\u001b[0m \u001b[0;32mfrom\u001b[0m \u001b[0mthere\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 655\u001b[0m \"\"\"\n\u001b[0;32m--> 656\u001b[0;31m \u001b[0;32mreturn\u001b[0m \u001b[0mplot_dataframe\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mself\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m*\u001b[0m\u001b[0margs\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mkwargs\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 657\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 658\u001b[0m \u001b[0mplot\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__doc__\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mplot_dataframe\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0m__doc__\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/geopandas/plotting.py\u001b[0m in \u001b[0;36mplot_dataframe\u001b[0;34m(df, column, cmap, color, ax, cax, categorical, legend, scheme, k, vmin, vmax, markersize, figsize, legend_kwds, classification_kwds, missing_kwds, **style_kwds)\u001b[0m\n\u001b[1;32m 545\u001b[0m \u001b[0mfigsize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfigsize\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 546\u001b[0m \u001b[0mmarkersize\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mmarkersize\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 547\u001b[0;31m \u001b[0;34m**\u001b[0m\u001b[0mstyle_kwds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 548\u001b[0m )\n\u001b[1;32m 549\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/geopandas/plotting.py\u001b[0m in \u001b[0;36mplot_series\u001b[0;34m(s, cmap, color, ax, figsize, **style_kwds)\u001b[0m\n\u001b[1;32m 371\u001b[0m \u001b[0mvalues_\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mvalues\u001b[0m\u001b[0;34m[\u001b[0m\u001b[0mpoly_idx\u001b[0m\u001b[0;34m]\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mcmap\u001b[0m \u001b[0;32melse\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 372\u001b[0m plot_polygon_collection(\n\u001b[0;32m--> 373\u001b[0;31m \u001b[0max\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mpolys\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mvalues_\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mfacecolor\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mfacecolor\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mcmap\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mcmap\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0;34m**\u001b[0m\u001b[0mstyle_kwds\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 374\u001b[0m )\n\u001b[1;32m 375\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/geopandas/plotting.py\u001b[0m in \u001b[0;36mplot_polygon_collection\u001b[0;34m(ax, geoms, values, color, cmap, vmin, vmax, **kwargs)\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[0;32mexcept\u001b[0m \u001b[0mImportError\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 83\u001b[0m raise ImportError(\n\u001b[0;32m---> 84\u001b[0;31m \u001b[0;34m\"The descartes package is required for plotting polygons in geopandas. \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m\u001b[1;32m 85\u001b[0m \u001b[0;34m\"You can install it using 'conda install -c conda-forge descartes' or \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 86\u001b[0m \u001b[0;34m\"'pip install descartes'.\"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mImportError\u001b[0m: The descartes package is required for plotting polygons in geopandas. You can install it using 'conda install -c conda-forge descartes' or 'pip install descartes'." ] }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAQYAAAD8CAYAAACVSwr3AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAMbElEQVR4nO3bcYikd33H8ffHXFNpGrWYFeTuNJFeGq+2kHRJU4SaYlouKdz9YZE7CG1KyKE1UlAKKZZU4l9WakG41l6pRAWNp3+UBU8CtZGAeDEbEmPuQmQ9bXNRmjOm/iMaQ7/9YybtZL+7mSd3szO39f2ChXme+e3Md4fhfc8881yqCkma9IpFDyDpwmMYJDWGQVJjGCQ1hkFSYxgkNVPDkOQTSZ5O8tgm9yfJx5KsJXk0yTWzH1PSPA05Yrgb2PcS998I7Bn/HAb+4fzHkrRIU8NQVfcDP3yJJQeAT9XICeA1SV4/qwElzd+OGTzGTuDJie0z433fX78wyWFGRxVccsklv3XVVVfN4Oklbeahhx76QVUtvdzfm0UYBquqo8BRgOXl5VpdXZ3n00s/d5L8+7n83iy+lXgK2D2xvWu8T9I2NYswrAB/PP524jrgR1XVPkZI2j6mfpRI8lngeuCyJGeAvwZ+AaCqPg4cB24C1oAfA3+6VcNKmo+pYaiqQ1PuL+A9M5tI0sJ55aOkxjBIagyDpMYwSGoMg6TGMEhqDIOkxjBIagyDpMYwSGoMg6TGMEhqDIOkxjBIagyDpMYwSGoMg6TGMEhqDIOkxjBIagyDpMYwSGoMg6TGMEhqDIOkxjBIagyDpMYwSGoMg6TGMEhqDIOkxjBIagyDpMYwSGoMg6RmUBiS7E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lBVXwNeyeg/WF2IBr23X2SLT4rsAE4DV/B/J3F+fd2a9/Dik4/HFnQCZ8isVzM6KbVnETO+3HnXrf8Kizv5OOS13Qd8cnz7MkaHvq+9gOf9EnDL+PabGZ1jyALfD5ez+cnHP+TFJx+/PvXx5jDwTYzq/23gA+N9dzH6FxdGpf08sAZ8HXjTAl/cabP+K/CfwCPjn5VFzTpk3nVrFxaGga9tGH30OQV8Ezh4Ib+2jL6J+Oo4Go8Af7DAWT8LfB/4GaMjr1uBdwHvmnhtj4z/lm8OeR94SbSkxisfJTWGQVJjGCQ1hkFSYxgkNYZBUmMYJDX/AwqkUdV2nfELAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "import geopandas as gpd\n", "world = gpd.read_file(gpd.datasets.get_path('naturalearth_lowres'))\n", "world.plot()" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "covid_data.plot(kind=\"scatter\", x=\"Long\", y=\"Lat\")" ] }, { "cell_type": "code", "execution_count": 168, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DateRepDayMonthYearCasesDeathsCountries and territoriesGeoId
39852019-12-313112201900MexicoMX
39842020-01-0111202000MexicoMX
39532020-01-0212202000MexicoMX
39242020-01-0313202020MexicoMX
39722020-01-13131202000MexicoMX
...........................
39742020-11-01111202000MexicoMX
39432020-11-02112202000MexicoMX
39732020-12-01121202000MexicoMX
39422020-12-02122202000MexicoMX
39212020-12-03123202040MexicoMX
\n", "

77 rows × 8 columns

\n", "
" ], "text/plain": [ " DateRep Day Month Year Cases Deaths Countries and territories \\\n", "3985 2019-12-31 31 12 2019 0 0 Mexico \n", "3984 2020-01-01 1 1 2020 0 0 Mexico \n", "3953 2020-01-02 1 2 2020 0 0 Mexico \n", "3924 2020-01-03 1 3 2020 2 0 Mexico \n", "3972 2020-01-13 13 1 2020 0 0 Mexico \n", "... ... ... ... ... ... ... ... \n", "3974 2020-11-01 11 1 2020 0 0 Mexico \n", "3943 2020-11-02 11 2 2020 0 0 Mexico \n", "3973 2020-12-01 12 1 2020 0 0 Mexico \n", "3942 2020-12-02 12 2 2020 0 0 Mexico \n", "3921 2020-12-03 12 3 2020 4 0 Mexico \n", "\n", " GeoId \n", "3985 MX \n", "3984 MX \n", "3953 MX \n", "3924 MX \n", "3972 MX \n", "... ... \n", "3974 MX \n", "3943 MX \n", "3973 MX \n", "3942 MX \n", "3921 MX \n", "\n", "[77 rows x 8 columns]" ] }, "execution_count": 168, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from datetime import datetime\n", "mexico['DateRep'] =pd.to_datetime(mexico.DateRep, format=\"%d/%m/%Y\")\n", "mexico_sort=mexico.sort_values(by='DateRep', ascending=True)\n", "mexico_sort" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 156, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 156, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAX4AAAEGCAYAAABiq/5QAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADh0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uMy4yLjEsIGh0dHA6Ly9tYXRwbG90bGliLm9yZy+j8jraAAAX1UlEQVR4nO3df5Dc9X3f8edrpeV01QlzOh0aVWf5iIXtYvc4uxdsLOoaE8c/kgg6csEu42oSGrWZ4tpJWgTtZGJPmxk4zyTg/ETBjuUOdmA4u1KwDaEyxKkzJQhbOiMwBmNTnQJIvp6MjpzOJ+27f3y/F/ZOK+kk3Xd/fV6PGc3ufva7u++Pdu913/vs9/P5KiIwM7N0lBpdgJmZ1ZeD38wsMQ5+M7PEOPjNzBLj4DczS8zSRhewEKtWrYr+/v5Gl2Fm1lIef/zxH0dE7/z2lgj+/v5+du/e3egyzMxaiqTna7V7qMfMLDEOfjOzxDj4zcwS4+A3M0uMg9/MLDEO/sSNT06zd/9hxienG12KmdVJSxzOacXYsecAW0dGKZdKzFQqDG8aYOPg2kaXZWYF8x5/osYnp9k6MsrRmQpHpo9xdKbCTSOj3vM3S4CDP1FjE1OUS3Pf/nKpxNjEVIMqMrN6cfAnqq+7k5lKZU7bTKVCX3dngyoys3px8Ceqp6uD4U0DLCuXWNGxlGXlEsObBujp6mh0aWZWMH+5m7CNg2vZsH4VYxNT9HV3OvTNEuHgT1xPV4cD3ywxHuoxM0uMg9/MLDEOfjOzxDj4zcwS4+A3M0uMg9/MLDEOfjOzxDj4zcwSU2jwS7pA0n2SvifpKUmXS1op6SFJz+SX3UXWYGZmcxW9x38H8EBEvAm4FHgKuBnYFREXA7vy22ZmVieFBb+k1wDvAj4LEBE/jYjDwNXA9nyz7cA1RdVgZmYnKnKP/yLgEPBnkr4j6S5Jy4HVEfF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XOZ3/cc8KY2/bn7EvBk/u+cjjZrYN/+GjgETJFlx/vy9v+Y3z4G/B1w12K9h2fzz0s2mJklpqnG+M3MrHgOfjOzxDj4zcwS4+A3M0uMg9/MLDEOfkuKpOP5hJt9ylYp/U1Jp/w5yJcR+NcLeO5+SVP58z8p6Qv5BCKzpuLgt9RMRcRgRLyZbMGuDwC/fZrH9AOnDf7cDyJiEPinZDM8rz3bQs2K4uC3ZEXEQWALcKMy/ZL+WtK383/vzDe9Ffjn+Z78r0taIunTkh5Ttn77v6vx3MeBvyVfzEvSP5P0V5Iel/Rg1ZIBj0i6I3/uJyQtyjITZqfSdIu0mdVTRDyn7GQ0F5Kt2fLeiDgq6WKymaRDZNP6/1NE/CKApC3ATyLiZyV1AN+S9Jdks0TJt1kGvB34eD7c8/tk678cknQd8DtkM1gB/lFEDEp6F/A54C116LolzMFv9qoy8AeSBoHjZOve1/LzwICkD+W3XwNcTDal//WS9pCt6/LViBiV9BayMH8oXxlyCfBC1fN9CSAivinpfEkXRMThRe6b2T9w8FvSJP0MWcgfJBvrfwm4lGwY9OjJHgZ8LCIenPdc/eRj/MpOr/etfNXGHwL7Ilt1spb566Z4HRUrlMf4LVmSeoE/Af4gskWrXgO8EBEVsvXuZ89HfITs1H2zHgR+bfaIHUlvkLS8+rkj4sdkQ0S3kC0x3Cvp8nz7sqQ3V21+Xd5+BdkQ0k8Wt6dmc3mP31LTmQ/FlMlWSvwfwO/m9/0RMCLp3wAPAK/k7aPAcUl7gc+TrfzZD3xb2djNIbIzRs33P4FPko31fwj4jKTXkP3c3U62iijAUUnfyWv6lRrPY7aovDqnWQNJeoTsi+Pdja7F0uGhHjOzxHiP38wsMd7jNzNLjIPfzCwxDn4zs8Q4+M3MEuPgNzNLzP8HdHB3kuxkNDoAAAAASUVORK5CYII=\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "mexico_filter = mexico_sort[mexico_sort['Cases']!=0]\n", "mexico_filter.plot(kind=\"scatter\", x=\"DateRep\", y=\"Cases\")" ] }, { "cell_type": "code", "execution_count": 157, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
DateRepDayMonthYearCasesDeathsCountries and territoriesGeoId
39242020-01-0313202020MexicoMX
39232020-02-0323202010MexicoMX
39252020-02-29292202020MexicoMX
39202020-03-13133202050MexicoMX
39192020-03-141432020100MexicoMX
39182020-03-151532020150MexicoMX
39172020-03-161632020120MexicoMX
39162020-03-171732020290MexicoMX
39152020-03-181832020110MexicoMX
39142020-03-191932020250MexicoMX
39132020-03-202032020460MexicoMX
39122020-03-212132020392MexicoMX
39112020-03-222232020480MexicoMX
39102020-03-232332020650MexicoMX
39092020-03-242432020512MexicoMX
39222020-09-0393202020MexicoMX
39212020-12-03123202040MexicoMX
\n", "
" ], "text/plain": [ " DateRep Day Month Year Cases Deaths Countries and territories \\\n", "3924 2020-01-03 1 3 2020 2 0 Mexico \n", "3923 2020-02-03 2 3 2020 1 0 Mexico \n", "3925 2020-02-29 29 2 2020 2 0 Mexico \n", "3920 2020-03-13 13 3 2020 5 0 Mexico \n", "3919 2020-03-14 14 3 2020 10 0 Mexico \n", "3918 2020-03-15 15 3 2020 15 0 Mexico \n", "3917 2020-03-16 16 3 2020 12 0 Mexico \n", "3916 2020-03-17 17 3 2020 29 0 Mexico \n", "3915 2020-03-18 18 3 2020 11 0 Mexico \n", "3914 2020-03-19 19 3 2020 25 0 Mexico \n", "3913 2020-03-20 20 3 2020 46 0 Mexico \n", "3912 2020-03-21 21 3 2020 39 2 Mexico \n", "3911 2020-03-22 22 3 2020 48 0 Mexico \n", "3910 2020-03-23 23 3 2020 65 0 Mexico \n", "3909 2020-03-24 24 3 2020 51 2 Mexico \n", "3922 2020-09-03 9 3 2020 2 0 Mexico \n", "3921 2020-12-03 12 3 2020 4 0 Mexico \n", "\n", " GeoId \n", "3924 MX \n", "3923 MX \n", "3925 MX \n", "3920 MX \n", "3919 MX \n", "3918 MX \n", "3917 MX \n", "3916 MX \n", "3915 MX \n", "3914 MX \n", "3913 MX \n", "3912 MX \n", "3911 MX \n", "3910 MX \n", "3909 MX \n", "3922 MX \n", "3921 MX " ] }, "execution_count": 157, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mexico_filter.head(77)" ] }, { "cell_type": "code", "execution_count": 164, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "367" ] }, "execution_count": 164, "metadata": {}, "output_type": "execute_result" } ], "source": [ "sum(mexico_filter.Cases)" ] }, { "cell_type": "code", "execution_count": 163, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "3985 2019-12-31\n", "3954 2020-01-31\n", "3955 2020-01-30\n", "3925 2020-02-29\n", "3956 2020-01-29\n", " ... \n", "3952 2020-02-02\n", "3983 2020-02-01\n", "3924 2020-01-03\n", "3953 2020-01-02\n", "3984 2020-01-01\n", "Name: DateRep, Length: 77, dtype: datetime64[ns]" ] }, "execution_count": 163, "metadata": {}, "output_type": "execute_result" } ], "source": [ "mexico.DateRep" ] }, { "cell_type": "code", "execution_count": 160, "metadata": {}, "outputs": [], "source": [ "import sklearn\n", "# Select a linear model\n", "lin_reg_model = sklearn.linear_model.LinearRegression()\n", "# Train the model\n" ] }, { "cell_type": "code", "execution_count": 161, "metadata": {}, "outputs": [ { "ename": "ValueError", "evalue": "Expected 2D array, got 1D array instead:\narray=[ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.\n 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36.\n 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54.\n 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72.\n 73. 74. 75. 76. 77.].\nReshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample.", "output_type": "error", "traceback": [ "\u001b[0;31m---------------------------------------------------------------------------\u001b[0m", "\u001b[0;31mValueError\u001b[0m Traceback (most recent call last)", "\u001b[0;32m\u001b[0m in \u001b[0;36m\u001b[0;34m\u001b[0m\n\u001b[1;32m 1\u001b[0m \u001b[0mX\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mnp\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mlinspace\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;36m1\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m77\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;36m77\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0maxis\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;36m0\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 2\u001b[0m \u001b[0my\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mmexico\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mCases\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m----> 3\u001b[0;31m \u001b[0mlin_reg_model\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mfit\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0mX\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0my\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/sklearn/linear_model/_base.py\u001b[0m in \u001b[0;36mfit\u001b[0;34m(self, X, y, sample_weight)\u001b[0m\n\u001b[1;32m 490\u001b[0m \u001b[0mn_jobs_\u001b[0m \u001b[0;34m=\u001b[0m \u001b[0mself\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mn_jobs\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 491\u001b[0m X, y = check_X_y(X, y, accept_sparse=['csr', 'csc', 'coo'],\n\u001b[0;32m--> 492\u001b[0;31m y_numeric=True, multi_output=True)\n\u001b[0m\u001b[1;32m 493\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 494\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0msample_weight\u001b[0m \u001b[0;32mis\u001b[0m \u001b[0;32mnot\u001b[0m \u001b[0;32mNone\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/sklearn/utils/validation.py\u001b[0m in \u001b[0;36mcheck_X_y\u001b[0;34m(X, y, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, multi_output, ensure_min_samples, ensure_min_features, y_numeric, warn_on_dtype, estimator)\u001b[0m\n\u001b[1;32m 753\u001b[0m \u001b[0mensure_min_features\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mensure_min_features\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 754\u001b[0m \u001b[0mwarn_on_dtype\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0mwarn_on_dtype\u001b[0m\u001b[0;34m,\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 755\u001b[0;31m estimator=estimator)\n\u001b[0m\u001b[1;32m 756\u001b[0m \u001b[0;32mif\u001b[0m \u001b[0mmulti_output\u001b[0m\u001b[0;34m:\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 757\u001b[0m y = check_array(y, 'csr', force_all_finite=True, ensure_2d=False,\n", "\u001b[0;32m~/lwc/topics/covid19/covid/lib/python3.7/site-packages/sklearn/utils/validation.py\u001b[0m in \u001b[0;36mcheck_array\u001b[0;34m(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)\u001b[0m\n\u001b[1;32m 554\u001b[0m \u001b[0;34m\"Reshape your data either using array.reshape(-1, 1) if \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 555\u001b[0m \u001b[0;34m\"your data has a single feature or array.reshape(1, -1) \"\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0;32m--> 556\u001b[0;31m \"if it contains a single sample.\".format(array))\n\u001b[0m\u001b[1;32m 557\u001b[0m \u001b[0;34m\u001b[0m\u001b[0m\n\u001b[1;32m 558\u001b[0m \u001b[0;31m# in the future np.flexible dtypes will be handled like object dtypes\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n", "\u001b[0;31mValueError\u001b[0m: Expected 2D array, got 1D array instead:\narray=[ 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 13. 14. 15. 16. 17. 18.\n 19. 20. 21. 22. 23. 24. 25. 26. 27. 28. 29. 30. 31. 32. 33. 34. 35. 36.\n 37. 38. 39. 40. 41. 42. 43. 44. 45. 46. 47. 48. 49. 50. 51. 52. 53. 54.\n 55. 56. 57. 58. 59. 60. 61. 62. 63. 64. 65. 66. 67. 68. 69. 70. 71. 72.\n 73. 74. 75. 76. 77.].\nReshape your data either using array.reshape(-1, 1) if your data has a single feature or array.reshape(1, -1) if it contains a single sample." ] } ], "source": [ "X = np.linspace(1,77,77, axis=0)\n", "y = mexico.Cases\n", "lin_reg_model.fit(X, y)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [ "y.shape" ] } ], "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 }