diff --git a/module3/exo2/exercice_python_fr.org b/module3/exo2/exercice_python_fr.org index 8690d0f11df99127cea936f2080929a16cebf013..59d691738fef66ac777c880af3dc1a793bae65c0 100644 --- a/module3/exo2/exercice_python_fr.org +++ b/module3/exo2/exercice_python_fr.org @@ -46,6 +46,39 @@ table[:5] | 202014 | 7 | 3879 | 2227 | 5531 | 6 | 3 | 9 | FR | France | | 202013 | 7 | 7326 | 5236 | 9416 | 11 | 8 | 14 | FR | France | -Ok à première vue. Vérifions l'intégrité du jeu de données (lignes -manquantes ou entrées erronnées). +** Extraction des colonnes utilisées + +#+begin_src python :results output :session :exports both +week = [row[0] for row in table] +assert week[0] == 'week' +del week[0] +inc = [row[2] for row in table] +assert inc[0] == 'inc' +del inc[0] +data = list(zip(week, inc)) +#+end_src + +#+RESULTS: + +Vérification visuelle des premières et dernières lignes. +#+begin_src python :results value :session :exports both +[('week', 'inc'), None] + data[:5] + [None] + data[-5:] +#+end_src + +#+RESULTS: +| week | inc | +|--------+-------| +| 202016 | 803 | +| 202015 | 1918 | +| 202014 | 3879 | +| 202013 | 7326 | +| 202012 | 8123 | +|--------+-------| +| 199101 | 15565 | +| 199052 | 19375 | +| 199051 | 19080 | +| 199050 | 11079 | +| 199049 | 1143 | + +** Conversion des dates