Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
mooc-rr
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cb1e5ba91280d02583d0604166e71c1c
mooc-rr
Commits
434dcb19
Commit
434dcb19
authored
Apr 05, 2020
by
cb1e5ba91280d02583d0604166e71c1c
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no commit message
parent
299cb1ac
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
24 deletions
+33
-24
exercice.ipynb
module3/exo3/exercice.ipynb
+33
-24
No files found.
module3/exo3/exercice.ipynb
View file @
434dcb19
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
35
,
"execution_count": 1
61
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -35,7 +35,7 @@
...
@@ -35,7 +35,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
36
,
"execution_count": 1
62
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -164,7 +164,7 @@
...
@@ -164,7 +164,7 @@
"4 315.06 317.51 314.71 "
"4 315.06 317.51 314.71 "
]
]
},
},
"execution_count": 1
36
,
"execution_count": 1
62
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -196,7 +196,7 @@
...
@@ -196,7 +196,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
37
,
"execution_count": 1
63
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -217,7 +217,7 @@
...
@@ -217,7 +217,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
38
,
"execution_count": 1
64
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -332,7 +332,7 @@
...
@@ -332,7 +332,7 @@
"4 1958 5 21320 1958.3699 317.51 314.71 317.86 315.06 317.51 314.71"
"4 1958 5 21320 1958.3699 317.51 314.71 317.86 315.06 317.51 314.71"
]
]
},
},
"execution_count": 1
38
,
"execution_count": 1
64
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -350,7 +350,7 @@
...
@@ -350,7 +350,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
39
,
"execution_count": 1
65
,
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
...
@@ -393,7 +393,7 @@
...
@@ -393,7 +393,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
40
,
"execution_count": 1
66
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -508,7 +508,7 @@
...
@@ -508,7 +508,7 @@
"75 1964 4 23482 1964.2896 NaN NaN 321.83 319.45 321.83 319.45"
"75 1964 4 23482 1964.2896 NaN NaN 321.83 319.45 321.83 319.45"
]
]
},
},
"execution_count": 1
40
,
"execution_count": 1
66
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -519,7 +519,7 @@
...
@@ -519,7 +519,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
41
,
"execution_count": 1
67
,
"metadata": {},
"metadata": {},
"outputs": [
"outputs": [
{
{
...
@@ -634,7 +634,7 @@
...
@@ -634,7 +634,7 @@
"6 1958 7 21381 1958.5370 315.86 315.19 315.86 315.22 315.86 315.19"
"6 1958 7 21381 1958.5370 315.86 315.19 315.86 315.22 315.86 315.19"
]
]
},
},
"execution_count": 1
41
,
"execution_count": 1
67
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
...
@@ -653,7 +653,7 @@
...
@@ -653,7 +653,7 @@
},
},
{
{
"cell_type": "code",
"cell_type": "code",
"execution_count": 1
46
,
"execution_count": 1
70
,
"metadata": {
"metadata": {
"scrolled": true
"scrolled": true
},
},
...
@@ -662,6 +662,8 @@
...
@@ -662,6 +662,8 @@
"name": "stdout",
"name": "stdout",
"output_type": "stream",
"output_type": "stream",
"text": [
"text": [
"(743, 10)\n",
"(743,)\n",
"(745, 11)\n"
"(745, 11)\n"
]
]
},
},
...
@@ -754,7 +756,7 @@
...
@@ -754,7 +756,7 @@
" <td>314.99</td>\n",
" <td>314.99</td>\n",
" <td>317.45</td>\n",
" <td>317.45</td>\n",
" <td>315.16</td>\n",
" <td>315.16</td>\n",
" <td>1958-0
7
-01</td>\n",
" <td>1958-0
6
-01</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <th>4</th>\n",
...
@@ -768,7 +770,7 @@
...
@@ -768,7 +770,7 @@
" <td>315.06</td>\n",
" <td>315.06</td>\n",
" <td>317.51</td>\n",
" <td>317.51</td>\n",
" <td>314.71</td>\n",
" <td>314.71</td>\n",
" <td>1958-0
8
-01</td>\n",
" <td>1958-0
7
-01</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <th>...</th>\n",
...
@@ -796,7 +798,7 @@
...
@@ -796,7 +798,7 @@
" <td>412.05</td>\n",
" <td>412.05</td>\n",
" <td>408.55</td>\n",
" <td>408.55</td>\n",
" <td>412.06</td>\n",
" <td>412.06</td>\n",
" <td>
NaN
</td>\n",
" <td>
2019-11-01
</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>741</th>\n",
" <th>741</th>\n",
...
@@ -810,7 +812,7 @@
...
@@ -810,7 +812,7 @@
" <td>412.29</td>\n",
" <td>412.29</td>\n",
" <td>408.43</td>\n",
" <td>408.43</td>\n",
" <td>412.07</td>\n",
" <td>412.07</td>\n",
" <td>
NaN
</td>\n",
" <td>
2019-12-01
</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>742</th>\n",
" <th>742</th>\n",
...
@@ -824,7 +826,7 @@
...
@@ -824,7 +826,7 @@
" <td>412.54</td>\n",
" <td>412.54</td>\n",
" <td>410.28</td>\n",
" <td>410.28</td>\n",
" <td>412.56</td>\n",
" <td>412.56</td>\n",
" <td>
NaN
</td>\n",
" <td>
2020-01-01
</td>\n",
" </tr>\n",
" </tr>\n",
" <tr>\n",
" <tr>\n",
" <th>743</th>\n",
" <th>743</th>\n",
...
@@ -877,31 +879,38 @@
...
@@ -877,31 +879,38 @@
"0 NaN 1958-03-01 \n",
"0 NaN 1958-03-01 \n",
"1 NaN 1958-04-01 \n",
"1 NaN 1958-04-01 \n",
"2 314.44 1958-05-01 \n",
"2 314.44 1958-05-01 \n",
"3 315.16 1958-0
7
-01 \n",
"3 315.16 1958-0
6
-01 \n",
"4 314.71 1958-0
8
-01 \n",
"4 314.71 1958-0
7
-01 \n",
".. ... ... \n",
".. ... ... \n",
"740 412.06
NaN
\n",
"740 412.06
2019-11-01
\n",
"741 412.07
NaN
\n",
"741 412.07
2019-12-01
\n",
"742 412.56
NaN
\n",
"742 412.56
2020-01-01
\n",
"743 412.78 NaN \n",
"743 412.78 NaN \n",
"744 413.33 NaN \n",
"744 413.33 NaN \n",
"\n",
"\n",
"[745 rows x 11 columns]"
"[745 rows x 11 columns]"
]
]
},
},
"execution_count": 1
46
,
"execution_count": 1
70
,
"metadata": {},
"metadata": {},
"output_type": "execute_result"
"output_type": "execute_result"
}
}
],
],
"source": [
"source": [
"data = data.dropna().copy()\n",
"#data = data.dropna().copy()\n",
"\n",
"print(data.shape)\n",
"\n",
"period = [datetime.date(y,m,1) for y,m in zip(data['Yr'],data['Mn'])]\n",
"period = [datetime.date(y,m,1) for y,m in zip(data['Yr'],data['Mn'])]\n",
"period = pd.Series(period)\n",
"period = pd.Series(period)\n",
"print(period.shape)\n",
"\n",
"newdf = pd.concat([data,period],axis=1)\n",
"newdf = pd.concat([data,period],axis=1)\n",
"\n",
"print(newdf.shape)\n",
"print(newdf.shape)\n",
"#data['period'] = pd.Series([datetime.date(y,m,1) for y,m in zip(data['Yr'],data['Mn'])])\n",
"#data['period'] = pd.Series([datetime.date(y,m,1) for y,m in zip(data['Yr'],data['Mn'])])\n",
"\n",
"\n",
"period\n",
"#data1 = data1.set_index('period') \n",
"#data1 = data1.set_index('period') \n",
"#data\n",
"#data\n",
"newdf"
"newdf"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment