Exercise03_part2

parent e2747783
...@@ -57,25 +57,11 @@ ...@@ -57,25 +57,11 @@
"La première ligne du fichier CSV est un commentaire, que nous ignorons en précisant `skiprows=1`." "La première ligne du fichier CSV est un commentaire, que nous ignorons en précisant `skiprows=1`."
] ]
}, },
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Note that the data will be only dowloaded if a local copy does not exist. If that is the case, a local copy of the data will be created after it has been downloaded"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 3, "execution_count": 3,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Local copy loaded\n"
]
},
{ {
"data": { "data": {
"text/html": [ "text/html": [
...@@ -1044,17 +1030,7 @@ ...@@ -1044,17 +1030,7 @@
} }
], ],
"source": [ "source": [
"try:\n", "raw_data = pd.read_csv(data_url, skiprows=1)\n",
" #Check if the local copy already exists\n",
" raw_data = pd.read_csv('raw_data_backup.csv')\n",
" print(\"Local copy loaded\")\n",
"except FileNotFoundError:\n",
" print(\"Local copy does not exist. The data will be downloaded again an a local copy will be created\")\n",
" raw_data = pd.read_csv(data_url, skiprows=1)\n",
" raw_data.to_csv('raw_data_backup.csv',index=False)\n",
"except:\n",
" print(\"Other error ocurred\")\n",
" \n",
"raw_data" "raw_data"
] ]
}, },
...@@ -2231,7 +2207,7 @@ ...@@ -2231,7 +2207,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f78c92b4a90>" "<matplotlib.axes._subplots.AxesSubplot at 0x7fa1a2ea0ba8>"
] ]
}, },
"execution_count": 9, "execution_count": 9,
...@@ -2270,7 +2246,7 @@ ...@@ -2270,7 +2246,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f78c707c898>" "<matplotlib.axes._subplots.AxesSubplot at 0x7fa1a0cc4a90>"
] ]
}, },
"execution_count": 10, "execution_count": 10,
...@@ -2324,7 +2300,7 @@ ...@@ -2324,7 +2300,7 @@
}, },
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 11, "execution_count": 17,
"metadata": {}, "metadata": {},
"outputs": [], "outputs": [],
"source": [ "source": [
...@@ -2374,7 +2350,7 @@ ...@@ -2374,7 +2350,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f78c6faa5c0>" "<matplotlib.axes._subplots.AxesSubplot at 0x7fa1a0bbbb00>"
] ]
}, },
"execution_count": 13, "execution_count": 13,
...@@ -2475,7 +2451,7 @@ ...@@ -2475,7 +2451,7 @@
{ {
"data": { "data": {
"text/plain": [ "text/plain": [
"<matplotlib.axes._subplots.AxesSubplot at 0x7f78c6f832e8>" "<matplotlib.axes._subplots.AxesSubplot at 0x7fa1a0b1c128>"
] ]
}, },
"execution_count": 15, "execution_count": 15,
......
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