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
08665f0d5a3cef5a146df356c344b7b3
mooc-rr
Commits
17173ffa
Commit
17173ffa
authored
Aug 28, 2024
by
08665f0d5a3cef5a146df356c344b7b3
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
no commit message
parent
6de3309d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
15 deletions
+21
-15
analyse-syndrome-grippal.ipynb
module3/exo1/analyse-syndrome-grippal.ipynb
+21
-15
No files found.
module3/exo1/analyse-syndrome-grippal.ipynb
View file @
17173ffa
...
@@ -34,7 +34,8 @@
...
@@ -34,7 +34,8 @@
},
},
"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\"\n",
"local_filename = \"incidence-PAY-3.csv\""
]
]
},
},
{
{
...
@@ -65,7 +66,19 @@
...
@@ -65,7 +66,19 @@
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"raw_data = pd.read_csv(data_url, skiprows=1)\n",
"if not os.path.exists(local_filename):\n",
" raw_data = pd.read_csv(data_url, skiprows=1)\n",
" raw_data.to_csv(local_filename, index=False) \n",
"else:\n",
" raw_data = pd.read_csv(local_filename)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"raw_data"
"raw_data"
]
]
},
},
...
@@ -278,12 +291,14 @@
...
@@ -278,12 +291,14 @@
"metadata": {},
"metadata": {},
"outputs": [],
"outputs": [],
"source": [
"source": [
"first_august_week = [pd.Period(pd.Timestamp(y, 8, 1), 'W')\n",
" for y in range(1985, sorted_data.index[-1].year)]\n",
"\n",
"year = []\n",
"year = []\n",
"yearly_incidence = []\n",
"yearly_incidence = []\n",
"for week1, week2 in zip(first_august_week[:-1],\n",
"for week1, week2 in zip(first_august_week[:-1], first_august_week[1:]):\n",
" first_august_week[1:]):\n",
" one_year = sorted_data['inc'][week1:week2-1]\n",
" one_year = sorted_data['inc'][week1:week2-1]\n",
" assert abs(len(one_year)
-
52) < 2\n",
" assert abs(len(one_year)
-
52) < 2\n",
" yearly_incidence.append(one_year.sum())\n",
" yearly_incidence.append(one_year.sum())\n",
" year.append(week2.year)\n",
" year.append(week2.year)\n",
"yearly_incidence = pd.Series(data=yearly_incidence, index=year)"
"yearly_incidence = pd.Series(data=yearly_incidence, index=year)"
...
@@ -337,15 +352,6 @@
...
@@ -337,15 +352,6 @@
"source": [
"source": [
"yearly_incidence.hist(xrot=20)"
"yearly_incidence.hist(xrot=20)"
]
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
}
],
],
"metadata": {
"metadata": {
...
@@ -364,7 +370,7 @@
...
@@ -364,7 +370,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,
...
...
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