From 4434659800fd6e319695b9c59199975939227836 Mon Sep 17 00:00:00 2001 From: escuiller Date: Mon, 27 Apr 2020 15:21:53 +0200 Subject: [PATCH] =?UTF-8?q?extraction=20des=20colonnes=20utilis=C3=A9es?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- module3/exo2/exercice_python_fr.org | 37 +++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/module3/exo2/exercice_python_fr.org b/module3/exo2/exercice_python_fr.org index 8690d0f..59d6917 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 -- 2.18.1