{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "## The incidence of chickenpox in France" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The data on the incidence of chickenpox-like illness are available from the Web site of the [Réseau Sentinelles](http://www.sentiweb.fr/). We download them as a file in CSV format, in which each line corresponds to a week in the observation period. " ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Requirement already satisfied: isoweek in /opt/conda/lib/python3.6/site-packages (1.3.3)\r\n" ] } ], "source": [ "!pip install isoweek" ] }, { "cell_type": "code", "execution_count": 4, "metadata": {}, "outputs": [], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "import pandas as pd\n", "import isoweek \n", "import os" ] }, { "cell_type": "code", "execution_count": 5, "metadata": {}, "outputs": [], "source": [ "data_url = \"http://www.sentiweb.fr/datasets/incidence-PAY-3.csv\" \n", "filename = \"inc-7-PAY-ds3.csv\"" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "1. Download -> if there is not a local file already" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "if not os.path.exists(filename):\n", " raw_data = pd.read_csv(data_url, encoding = 'iso-8859-1' , skiprows= 1 )\n", "else:\n", " raw_data = pd.read_csv(filename)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "2. Remove rows with missing values" ] }, { "cell_type": "code", "execution_count": 7, "metadata": { "scrolled": true }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
weekindicatorincinc_lowinc_upinc100inc100_lowinc100_upgeo_inseegeo_name
18831989193-NaNNaN-NaNNaNFRFrance
\n", "
" ], "text/plain": [ " week indicator inc inc_low inc_up inc100 inc100_low inc100_up \\\n", "1883 198919 3 - NaN NaN - NaN NaN \n", "\n", " geo_insee geo_name \n", "1883 FR France " ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "raw_data[raw_data.isnull(). any (axis= 1 )] " ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
weekindicatorincinc_lowinc_upinc100inc100_lowinc100_upgeo_inseegeo_name
020252432281617621.028011.03426.042.0FRFrance
120252332456419382.029746.03729.045.0FRFrance
220252231875514333.023177.02821.035.0FRFrance
320252132376018671.028849.03527.043.0FRFrance
420252032026515814.024716.03023.037.0FRFrance
520251931626412394.020134.02418.030.0FRFrance
620251831811513975.022255.02721.033.0FRFrance
720251732215017291.027009.03326.040.0FRFrance
820251632856422550.034578.04334.052.0FRFrance
920251533572129592.041850.05344.062.0FRFrance
1020251433757931232.043926.05647.065.0FRFrance
1120251333967333686.045660.05950.068.0FRFrance
1220251235254345627.059459.07868.088.0FRFrance
1320251135946952154.066784.08978.0100.0FRFrance
1420251036033453048.067620.09079.0101.0FRFrance
1520250938453174994.094068.0126112.0140.0FRFrance
162025083136020124824.0147216.0203186.0220.0FRFrance
172025073208952195988.0221916.0312293.0331.0FRFrance
182025063273519258159.0288879.0408385.0431.0FRFrance
192025053334395318416.0350374.0499475.0523.0FRFrance
202025043350043332885.0367201.0522496.0548.0FRFrance
212025033252772238917.0266627.0377356.0398.0FRFrance
222025023257247242991.0271503.0384363.0405.0FRFrance
232025013231549214627.0248471.0345320.0370.0FRFrance
242024523201726185870.0217582.0302278.0326.0FRFrance
252024513201697187843.0215551.0302281.0323.0FRFrance
262024503136694126369.0147019.0205190.0220.0FRFrance
27202449310848799037.0117937.0163149.0177.0FRFrance
2820244838738178687.096075.0131118.0144.0FRFrance
2920244737628667626.084946.0114101.0127.0FRFrance
.................................
209019852132609619621.032571.04735.059.0FRFrance
209119852032789620885.034907.05138.064.0FRFrance
209219851934315432821.053487.07859.097.0FRFrance
209319851834055529935.051175.07455.093.0FRFrance
209419851733405324366.043740.06244.080.0FRFrance
209519851635036236451.064273.09166.0116.0FRFrance
209619851536388145538.082224.011683.0149.0FRFrance
20971985143134545114400.0154690.0244207.0281.0FRFrance
20981985133197206176080.0218332.0357319.0395.0FRFrance
20991985123245240223304.0267176.0445405.0485.0FRFrance
21001985113276205252399.0300011.0501458.0544.0FRFrance
21011985103353231326279.0380183.0640591.0689.0FRFrance
21021985093369895341109.0398681.0670618.0722.0FRFrance
21031985083389886359529.0420243.0707652.0762.0FRFrance
21041985073471852432599.0511105.0855784.0926.0FRFrance
21051985063565825518011.0613639.01026939.01113.0FRFrance
21061985053637302592795.0681809.011551074.01236.0FRFrance
21071985043424937390794.0459080.0770708.0832.0FRFrance
21081985033213901174689.0253113.0388317.0459.0FRFrance
210919850239758680949.0114223.0177147.0207.0FRFrance
211019850138548965918.0105060.0155120.0190.0FRFrance
211119845238483060602.0109058.0154110.0198.0FRFrance
2112198451310172680242.0123210.0185146.0224.0FRFrance
21131984503123680101401.0145959.0225184.0266.0FRFrance
2114198449310107381684.0120462.0184149.0219.0FRFrance
211519844837862060634.096606.0143110.0176.0FRFrance
211619844737202954274.089784.013199.0163.0FRFrance
211719844638733067686.0106974.0159123.0195.0FRFrance
21181984453135223101414.0169032.0246184.0308.0FRFrance
211919844436842220056.0116788.012537.0213.0FRFrance
\n", "

2119 rows × 10 columns

\n", "
" ], "text/plain": [ " week indicator inc inc_low inc_up inc100 inc100_low \\\n", "0 202524 3 22816 17621.0 28011.0 34 26.0 \n", "1 202523 3 24564 19382.0 29746.0 37 29.0 \n", "2 202522 3 18755 14333.0 23177.0 28 21.0 \n", "3 202521 3 23760 18671.0 28849.0 35 27.0 \n", "4 202520 3 20265 15814.0 24716.0 30 23.0 \n", "5 202519 3 16264 12394.0 20134.0 24 18.0 \n", "6 202518 3 18115 13975.0 22255.0 27 21.0 \n", "7 202517 3 22150 17291.0 27009.0 33 26.0 \n", "8 202516 3 28564 22550.0 34578.0 43 34.0 \n", "9 202515 3 35721 29592.0 41850.0 53 44.0 \n", "10 202514 3 37579 31232.0 43926.0 56 47.0 \n", "11 202513 3 39673 33686.0 45660.0 59 50.0 \n", "12 202512 3 52543 45627.0 59459.0 78 68.0 \n", "13 202511 3 59469 52154.0 66784.0 89 78.0 \n", "14 202510 3 60334 53048.0 67620.0 90 79.0 \n", "15 202509 3 84531 74994.0 94068.0 126 112.0 \n", "16 202508 3 136020 124824.0 147216.0 203 186.0 \n", "17 202507 3 208952 195988.0 221916.0 312 293.0 \n", "18 202506 3 273519 258159.0 288879.0 408 385.0 \n", "19 202505 3 334395 318416.0 350374.0 499 475.0 \n", "20 202504 3 350043 332885.0 367201.0 522 496.0 \n", "21 202503 3 252772 238917.0 266627.0 377 356.0 \n", "22 202502 3 257247 242991.0 271503.0 384 363.0 \n", "23 202501 3 231549 214627.0 248471.0 345 320.0 \n", "24 202452 3 201726 185870.0 217582.0 302 278.0 \n", "25 202451 3 201697 187843.0 215551.0 302 281.0 \n", "26 202450 3 136694 126369.0 147019.0 205 190.0 \n", "27 202449 3 108487 99037.0 117937.0 163 149.0 \n", "28 202448 3 87381 78687.0 96075.0 131 118.0 \n", "29 202447 3 76286 67626.0 84946.0 114 101.0 \n", "... ... ... ... ... ... ... ... \n", "2090 198521 3 26096 19621.0 32571.0 47 35.0 \n", "2091 198520 3 27896 20885.0 34907.0 51 38.0 \n", "2092 198519 3 43154 32821.0 53487.0 78 59.0 \n", "2093 198518 3 40555 29935.0 51175.0 74 55.0 \n", "2094 198517 3 34053 24366.0 43740.0 62 44.0 \n", "2095 198516 3 50362 36451.0 64273.0 91 66.0 \n", "2096 198515 3 63881 45538.0 82224.0 116 83.0 \n", "2097 198514 3 134545 114400.0 154690.0 244 207.0 \n", "2098 198513 3 197206 176080.0 218332.0 357 319.0 \n", "2099 198512 3 245240 223304.0 267176.0 445 405.0 \n", "2100 198511 3 276205 252399.0 300011.0 501 458.0 \n", "2101 198510 3 353231 326279.0 380183.0 640 591.0 \n", "2102 198509 3 369895 341109.0 398681.0 670 618.0 \n", "2103 198508 3 389886 359529.0 420243.0 707 652.0 \n", "2104 198507 3 471852 432599.0 511105.0 855 784.0 \n", "2105 198506 3 565825 518011.0 613639.0 1026 939.0 \n", "2106 198505 3 637302 592795.0 681809.0 1155 1074.0 \n", "2107 198504 3 424937 390794.0 459080.0 770 708.0 \n", "2108 198503 3 213901 174689.0 253113.0 388 317.0 \n", "2109 198502 3 97586 80949.0 114223.0 177 147.0 \n", "2110 198501 3 85489 65918.0 105060.0 155 120.0 \n", "2111 198452 3 84830 60602.0 109058.0 154 110.0 \n", "2112 198451 3 101726 80242.0 123210.0 185 146.0 \n", "2113 198450 3 123680 101401.0 145959.0 225 184.0 \n", "2114 198449 3 101073 81684.0 120462.0 184 149.0 \n", "2115 198448 3 78620 60634.0 96606.0 143 110.0 \n", "2116 198447 3 72029 54274.0 89784.0 131 99.0 \n", "2117 198446 3 87330 67686.0 106974.0 159 123.0 \n", "2118 198445 3 135223 101414.0 169032.0 246 184.0 \n", "2119 198444 3 68422 20056.0 116788.0 125 37.0 \n", "\n", " inc100_up geo_insee geo_name \n", "0 42.0 FR France \n", "1 45.0 FR France \n", "2 35.0 FR France \n", "3 43.0 FR France \n", "4 37.0 FR France \n", "5 30.0 FR France \n", "6 33.0 FR France \n", "7 40.0 FR France \n", "8 52.0 FR France \n", "9 62.0 FR France \n", "10 65.0 FR France \n", "11 68.0 FR France \n", "12 88.0 FR France \n", "13 100.0 FR France \n", "14 101.0 FR France \n", "15 140.0 FR France \n", "16 220.0 FR France \n", "17 331.0 FR France \n", "18 431.0 FR France \n", "19 523.0 FR France \n", "20 548.0 FR France \n", "21 398.0 FR France \n", "22 405.0 FR France \n", "23 370.0 FR France \n", "24 326.0 FR France \n", "25 323.0 FR France \n", "26 220.0 FR France \n", "27 177.0 FR France \n", "28 144.0 FR France \n", "29 127.0 FR France \n", "... ... ... ... \n", "2090 59.0 FR France \n", "2091 64.0 FR France \n", "2092 97.0 FR France \n", "2093 93.0 FR France \n", "2094 80.0 FR France \n", "2095 116.0 FR France \n", "2096 149.0 FR France \n", "2097 281.0 FR France \n", "2098 395.0 FR France \n", "2099 485.0 FR France \n", "2100 544.0 FR France \n", "2101 689.0 FR France \n", "2102 722.0 FR France \n", "2103 762.0 FR France \n", "2104 926.0 FR France \n", "2105 1113.0 FR France \n", "2106 1236.0 FR France \n", "2107 832.0 FR France \n", "2108 459.0 FR France \n", "2109 207.0 FR France \n", "2110 190.0 FR France \n", "2111 198.0 FR France \n", "2112 224.0 FR France \n", "2113 266.0 FR France \n", "2114 219.0 FR France \n", "2115 176.0 FR France \n", "2116 163.0 FR France \n", "2117 195.0 FR France \n", "2118 308.0 FR France \n", "2119 213.0 FR France \n", "\n", "[2119 rows x 10 columns]" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "data = raw_data.dropna().copy()\n", "data " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "3. Convert 'week' to period " ] }, { "cell_type": "code", "execution_count": 10, "metadata": {}, "outputs": [], "source": [ "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' ]] " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "4. Set 'period' as index and sort the dataset" ] }, { "cell_type": "code", "execution_count": 44, "metadata": {}, "outputs": [], "source": [ "sorted_data = data.set_index( 'period' ).sort_index() \n", "# Ensure the 'inc' column is numeric\n", "sorted_data['inc'] = pd.to_numeric(sorted_data['inc'], errors='coerce')" ] }, { "cell_type": "code", "execution_count": 45, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1989-05-01/1989-05-07 1989-05-15/1989-05-21\n" ] } ], "source": [ "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) " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "5. Choose September 1st as the beginning of each annual period" ] }, { "cell_type": "code", "execution_count": 46, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[Period('1985-08-26/1985-09-01', 'W-SUN'),\n", " Period('1986-09-01/1986-09-07', 'W-SUN'),\n", " Period('1987-08-31/1987-09-06', 'W-SUN'),\n", " Period('1988-08-29/1988-09-04', 'W-SUN'),\n", " Period('1989-08-28/1989-09-03', 'W-SUN'),\n", " Period('1990-08-27/1990-09-02', 'W-SUN'),\n", " Period('1991-08-26/1991-09-01', 'W-SUN'),\n", " Period('1992-08-31/1992-09-06', 'W-SUN'),\n", " Period('1993-08-30/1993-09-05', 'W-SUN'),\n", " Period('1994-08-29/1994-09-04', 'W-SUN'),\n", " Period('1995-08-28/1995-09-03', 'W-SUN'),\n", " Period('1996-08-26/1996-09-01', 'W-SUN'),\n", " Period('1997-09-01/1997-09-07', 'W-SUN'),\n", " Period('1998-08-31/1998-09-06', 'W-SUN'),\n", " Period('1999-08-30/1999-09-05', 'W-SUN'),\n", " Period('2000-08-28/2000-09-03', 'W-SUN'),\n", " Period('2001-08-27/2001-09-02', 'W-SUN'),\n", " Period('2002-08-26/2002-09-01', 'W-SUN'),\n", " Period('2003-09-01/2003-09-07', 'W-SUN'),\n", " Period('2004-08-30/2004-09-05', 'W-SUN'),\n", " Period('2005-08-29/2005-09-04', 'W-SUN'),\n", " Period('2006-08-28/2006-09-03', 'W-SUN'),\n", " Period('2007-08-27/2007-09-02', 'W-SUN'),\n", " Period('2008-09-01/2008-09-07', 'W-SUN'),\n", " Period('2009-08-31/2009-09-06', 'W-SUN'),\n", " Period('2010-08-30/2010-09-05', 'W-SUN'),\n", " Period('2011-08-29/2011-09-04', 'W-SUN'),\n", " Period('2012-08-27/2012-09-02', 'W-SUN'),\n", " Period('2013-08-26/2013-09-01', 'W-SUN'),\n", " Period('2014-09-01/2014-09-07', 'W-SUN'),\n", " Period('2015-08-31/2015-09-06', 'W-SUN'),\n", " Period('2016-08-29/2016-09-04', 'W-SUN'),\n", " Period('2017-08-28/2017-09-03', 'W-SUN'),\n", " Period('2018-08-27/2018-09-02', 'W-SUN'),\n", " Period('2019-08-26/2019-09-01', 'W-SUN'),\n", " Period('2020-08-31/2020-09-06', 'W-SUN'),\n", " Period('2021-08-30/2021-09-05', 'W-SUN'),\n", " Period('2022-08-29/2022-09-04', 'W-SUN'),\n", " Period('2023-08-28/2023-09-03', 'W-SUN'),\n", " Period('2024-08-26/2024-09-01', 'W-SUN')]" ] }, "execution_count": 46, "metadata": {}, "output_type": "execute_result" } ], "source": [ "first_sept_week = [pd.Period(pd.Timestamp(y, 9 , 1 ), 'W' )\n", " for y in range ( 1985 ,\n", " sorted_data.index[- 1 ].year)] \n", "first_sept_week" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "6. Collect the incidence per year information" ] }, { "cell_type": "code", "execution_count": 47, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "2021 772545\n", "2014 1601698\n", "1991 1663610\n", "1995 1828304\n", "2020 2017296\n", "2022 2057596\n", "2012 2183912\n", "2003 2234514\n", "2019 2254363\n", "2006 2297262\n", "2017 2322818\n", "2001 2540826\n", "1992 2590314\n", "1993 2699482\n", "2018 2701716\n", "1988 2759663\n", "2007 2786458\n", "2011 2852504\n", "2016 2859019\n", "1987 2867464\n", "2023 2908672\n", "2008 2984311\n", "1998 3047298\n", "2002 3115484\n", "1994 3514133\n", "1996 3540251\n", "2009 3558474\n", "2004 3572810\n", "1997 3624129\n", "2015 3647492\n", "2024 3691245\n", "2000 3808190\n", "2005 3831409\n", "1999 3914003\n", "2010 3992174\n", "2013 4176872\n", "1986 5050543\n", "1990 5214494\n", "1989 5461328\n", "dtype: int64" ] }, "execution_count": 47, "metadata": {}, "output_type": "execute_result" } ], "source": [ "year = []\n", "yearly_incidence = []\n", "for week1, week2 in zip (first_sept_week[:- 1 ],first_sept_week[ 1 :]):\n", " one_year = sorted_data[ 'inc' ][week1:week2- 1 ]\n", " assert abs ( len (one_year)- 52 ) < 2 \n", " yearly_incidence.append(one_year. sum ())\n", " year.append(week2.year)\n", "yearly_incidence = pd.Series(data=yearly_incidence, index=year) \n", "yearly_incidence.sort_values()" ] }, { "cell_type": "code", "execution_count": 48, "metadata": {}, "outputs": [ { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYIAAAEWCAYAAABrDZDcAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAADl0RVh0U29mdHdhcmUAbWF0cGxvdGxpYiB2ZXJzaW9uIDIuMi4zLCBodHRwOi8vbWF0cGxvdGxpYi5vcmcvIxREBQAAGfpJREFUeJzt3X2cXVV97/HP1wRIYEIIBqYxPAwILyqSimZQkV47w0OLgtrbcgEvKig0LRaNEusNAhWtD7QWX2rbeyFViwTKoDwowvUBkQGtPE0QDAiRCAESYiIiCYNRSPz1j73G7Bzn4ZzMnLNnZn3fr9d5zZ61915rnTUz5zt77XP2VkRgZmb5elHVHTAzs2o5CMzMMucgMDPLnIPAzCxzDgIzs8w5CMzMMucgyIykiyWdP0Z17SOpX9KU9H2vpDPGou5U3zcknTpW9TXQ7sckPSXpZ61uu6YfUyWFpI6K2p+Sfr77DLH+DEm9Le6WNYGDYBKRtErSJknPSnpG0g8k/Y2k3/2cI+JvIuIf6qzr6OG2iYjHI6ItIraMQd8vkHR5Tf1viIgvjbbuBvuxN7AIODgi/qBmXXsKiK6a8v+QdGULuzkiSZdLumA0dUTElvTzfXyMumXjlINg8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GaXlH1D8Q5DNGDQ8ZlV3YAx/+FcCa4EXKFL5dIp5uZuBh9PX3Uvbn0vx7oAVpHcCpPJO4P607l/Z+unraekHuZLinQT7l/Z5VypfCbyzVL5/2nZl2nenJj7/P6Y41PwRcG96vDGzMfgj4IdpDO4H/j6VZzMGNePRxdYgyGYMUlv3pccDwLm5jUGjD19iwswsc5P9HIGZmY3AQWBmljkHgZlZ5hwEZmaZcxCYmWXOQWCTnqT+7dyvU9Lnhli3StLs0fXMbHzI9RITZiOKiD6gr+p+mDWbjwgsG5K6JPVKulrSQ5KuKF1f/jBJP1BxL4O7JM1I2w9cz//Fkr6drvF/CaVrx0h6W9rnXkmXSJqSyvslfTzVeYek9lTeLum6VH6fpNcNV49ZszkILDevBN5HcQ36/YEj0g1CrgIWRsQrgKOBTTX7fRj4fkS8Erge2AdA0suAkygucnYosAU4Je2zC3BHqvM24K9S+eeAW1P5q4AHRqjHrKk8NWS5uSsiVgOky1V3UFxCeG1E3A0QERvT+vJ+rwf+Iq2/UdIvU/lRwHzg7rT9dLZezOx54Ia0vIzi/hBQ3CfgHamuLcAGSW8fph6zpnIQWG5+U1reQvE3IOq7JPBg2wj4UkScM8i6F2LrNVwG2hrKcPWYNZWnhszgIeAlkg4DSOcHal+0byNN1Uh6A8WVJaG4eNkJ6br3A/fF3XeE9m4GzkzbT5G063bWYzYmHASWvYh4nmJ+/l8k3QfcRHF1ybKPAK+XdA/wp8Djad8fA+dR3A3rR2nfOSM0uRDolrScYsro5dtZj9mY8NVHzcwy5yMCM7PMOQjMzDLnIDAzy5yDwMwscw4CM7PMOQjMzDLnIDAzy9x/A9dYlpQpAPBYAAAAAElFTkSuQmCC\n", "text/plain": [ "
" ] }, "metadata": { "needs_background": "light" }, "output_type": "display_data" } ], "source": [ "yearly_incidence.hist()\n", "plt.title(\"Distribution of Yearly Incidence\")\n", "plt.xlabel(\"Incidence\")\n", "plt.ylabel(\"Count\")\n", "plt.show()" ] }, { "cell_type": "code", "execution_count": 50, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Strongest epidemic year: 1989\n", "Weakest epidemic year: 2021\n" ] } ], "source": [ "strongest = yearly_incidence.idxmax()\n", "weakest = yearly_incidence.idxmin()\n", "print(f\"Strongest epidemic year: {strongest}\")\n", "print(f\"Weakest epidemic year: {weakest}\")" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.6.4" } }, "nbformat": 4, "nbformat_minor": 2 }