Autour du SARS-CoV-2 (Covid-19)

parent 9a37942f
{ {
"cells": [], "cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%matplotlib inline\n",
"import matplotlib.pyplot as plt\n",
"import pandas as pd\n",
"import isoweek\n",
"\n",
"data_url =\"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\"\n",
"\n",
"raw_data = pd.read_csv(data_url, skiprows=1)\n",
"raw_data\n",
"\n",
"raw_data[raw_data.isnull().any(axis=1)] \n",
"\n",
"data = raw_data.dropna().copy()\n",
"data\n",
"\n",
"def convert_week(year_and_week_int):\n",
" year_and_week_str = str(year_and_week_int)\n",
" year = int(year_and_week_str[:4])\n",
" week = int(year_and_week_str[4:])\n",
" w = isoweek.Week(year, week)\n",
" return pd.Period(w.day(0), 'W')\n",
"\n",
"data['period'] = [convert_week(yw) for yw in data['week']]\n",
"\n",
"sorted_data = data.set_index('period').sort_index()\n",
"\n",
"periods = sorted_data.index\n",
"for p1, p2 in zip(periods[:-1], periods[1:]):\n",
" delta = p2.to_timestamp() - p1.end_time\n",
" if delta > pd.Timedelta('1s'):\n",
" print(p1, p2)\n",
" \n",
" sorted_data['inc'].plot()\n",
" \n",
" <matplotlib.axes._subplots.AxesSubplot at 0x1198af710>"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": { "metadata": {
"kernelspec": { "kernelspec": {
"display_name": "Python 3", "display_name": "Python 3",
...@@ -16,10 +81,9 @@ ...@@ -16,10 +81,9 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.6.3" "version": "3.6.4"
} }
}, },
"nbformat": 4, "nbformat": 4,
"nbformat_minor": 2 "nbformat_minor": 2
} }
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