Module 3 - Exo 1

parent 2bd12eef
...@@ -9,14 +9,15 @@ ...@@ -9,14 +9,15 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"%matplotlib inline\n", "%matplotlib inline\n",
"import matplotlib.pyplot as plt\n", "import matplotlib.pyplot as plt\n",
"import pandas as pd\n", "import pandas as pd\n",
"import isoweek" "import isoweek\n",
"import os.path"
] ]
}, },
{ {
...@@ -28,10 +29,8 @@ ...@@ -28,10 +29,8 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 3,
"metadata": { "metadata": {},
"collapsed": true
},
"outputs": [], "outputs": [],
"source": [ "source": [
"data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"" "data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\""
...@@ -61,12 +60,17 @@ ...@@ -61,12 +60,17 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": null, "execution_count": 4,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
"raw_data = pd.read_csv(data_url, skiprows=1)\n", "from pathlib import Path\n",
"raw_data" "my_file = Path(\"data_file.csv\")\n",
"if my_file.exists():\n",
" raw_data = pd.read_csv(my_file, skiprows=1)\n",
"else:\n",
" raw_data = pd.read_csv(data_url, skiprows=1)\n",
" raw_data.to_csv(\"data_file.csv\")"
] ]
}, },
{ {
...@@ -364,7 +368,7 @@ ...@@ -364,7 +368,7 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.1" "version": "3.6.4"
} }
}, },
"nbformat": 4, "nbformat": 4,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment