Populations des communes françaises (Métropole)
On s'intéresse au fichier pop_hist.csv regroupant des informations sur la population des communes de France Métropolitaine à travers l'histoire.
Ce fichier a été adapté à partir de cette source. Les adaptations faites sont :
-
suppression des données de population pour certaines années,
-
suppression des communes pour lesquelles les données sont incomplÚtes (populations anciennes manquantes). Cette suppression explique que les communes listées soient toutes en métropole (hors Corse).
Fichier volumineux
Le fichier comporte 34 496 lignes !
On déconseille vivement d'afficher la totalité du tableau avec Python...
Les premiĂšres lignes de ce fichier sont :
đ DonnĂ©es CSVdepartement;nom;pop_2019;pop_2009;pop_1999;pop_1990;pop_1982;pop_1968;pop_1954;pop_1936;pop_1926;pop_1906;pop_1896;pop_1886;pop_1876
Ain;L'Abergement-Clémenciat;779;787;728;579;477;347;424;506;543;629;572;622;604
Les descripteurs sont explicités ci-dessous :
Descripteur |
Indice |
Type Python |
Contenu |
departement |
0 |
str |
département de la commune |
nom |
1 |
str |
nom de la commune |
pop_2019 |
2 |
int |
population en 2019 |
pop_2009 |
3 |
int |
population en 2009 |
pop_1999 |
4 |
int |
population en 1999 |
pop_1990 |
5 |
int |
population en 1990 |
pop_1982 |
6 |
int |
population en 1982 |
pop_1968 |
7 |
int |
population en 1968 |
pop_1954 |
8 |
int |
population en 1954 |
pop_1936 |
9 |
int |
population en 1936 |
pop_1926 |
10 |
int |
population en 1926 |
pop_1906 |
11 |
int |
population en 1906 |
pop_1896 |
12 |
int |
population en 1896 |
pop_1886 |
13 |
int |
population en 1886 |
pop_1876 |
14 |
int |
population en 1876 |
On propose ci-dessous deux versions du mĂȘme exercice selon le type de listes choisis : liste de listes ou de dictionnaires.
ActivitĂ© 1 - RequĂȘtes dans une liste de listes
ComplĂ©ter le script ci-dessous afin d'effectuer les requĂȘtes demandĂ©es.
Il faudra tout d'abord importer et typer les données ici sous la forme d'une liste de listes.
La liste reprenant l'ensemble des informations sera communes
.
Il y a beaucoup de données : le script met un peu de temps à s'exécuter
.128013rt=7*flb)H1 2eĂ /vyg.:,-]8Tsw9nuph5aS(o3qĂčMk_i46P;zĂ©[cdm0050$0o0c0J0T0h0B0m0#0h0J0B0B0d010c0T0G010406050B0F0%0%0J0b0s040K0M0h0F0|0M0E050q13151719110G04051p1i1s0q1p110$0T0r0;0?0^0`0H0T0t0H0h1G0H0c0 050,0i0h0o1B0@0_011F1H1J1H0c1P1R1N0c0b1q0c0H0;1c0B0G0J0E0`0n011T1D010g0.0o0E0J0%0o1N1:1=1`1V1}1R20220 0a0m0W0b0M0G0M0B0T1f0E0m0*1.0b0b0o0#2n1i250E1q0q1,2A1)1+1*1O0$270`1J0E1 2k1N1y1A0=1U2K0T2M0E0M2Q1N0G2t1q2y2A2(121;2o2S1{2X0b160h0 0m0l2x2,102+262.1V2:2=2@0n2`1=2|2y2J01310J2?040m0N352z11382 0`3b3d0m0U3h372,393n2@0I3r3j3t3l3a0M2;3c2@0V3y2}2-1C303D323e0e3I3k3L3m3N3F3e0z3R3A3T3C3E3o0D3Z2~3#3v040l0(3*3K2T3$3O0l2_1j2{3z3+3?3-0l343{363}3=2/3V3d0l3g433i3J3u480 0l3q4c3s3~473%4h3x4k454f4o3.3H4r4e3B403Q4x3S3 4g3.3Y4C3!4E4u0l3)4I4m3M4u0n3:4O464Q3O0n3`2(4s4z4F0n424!4y3,4%4b4*4D4n4X4j4/4J4;3W0n4q4@4P3U4R4w4}4V4 4X4B524t4X4H574$4R4N5b4,4u0N4T5f4K3O0N4Z3|4+5l3W0N4)5p4:4W5s4.5v4^5x3d0N4?5A4~3@5s4|5G535I5D515L585s562{1t2$1i2Q2D0$1+2I3B0#2Y231q5Y1r5W2*4k055(0*2%5B3m0 5(150F2M0B3r0m5q1{0M0 0d60621V0~040!0y3;390R0 0C2m0H675w3m0i0 2i1 3r680`6a0L6s6m3a0 290o6x5^016404665:6y0B1^04020O0F0M0c0X2j0G0S1F0B0c0u0#0B0r6O6Q6S6D5H6a0w6l6E0E0 0%5)6+5M6G6I2*6K6M6(6R0X0b6 6*6J6E6-6/5H6;041 5=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$0(d(0xjO0Gh d!b90lip5P44bIjujbiA9@elaui`8FiHhIdkhQiIhShb9/6.hieBi$hPj1hHe!iNd6i i^eSj:h2j^j?8C04j0c~j{iMe1iOf=c!k8hlfYiWj~hrffhtk43I0q5=0o2A8-2A5,2B5!1i2EkH0J1QkA5X1z2|0q0*0,0.0B04.
ActivitĂ© 2 - RequĂȘtes dans une liste de dictionnaires
ComplĂ©ter le script ci-dessous afin d'effectuer les requĂȘtes demandĂ©es.
Il faudra tout d'abord importer et typer les données ici sous la forme d'une liste de dictionnaires.
La liste reprenant l'ensemble des informations sera communes
.
Il y a beaucoup de données : le script met un peu de temps à s'exécuter
.128013tlH12Ă /vyg.]Tsw9huqĂčMi6PĂ©[-dm0r=7*fb)D e:,8Rnp5(aSo3k_4;zc050C0O0b0X0w0c0o0N0*0c0X0o0o0G010b0w0U010406050o0s0D0D0X0F0j040Y0Z0c0s0~0Z0T050h1517191b130U04051r1k1u0h1r130C0w0i0?0^0`0|0r0w0k0r0c1I0r0b11050.0K0c0O1D0_0{011H1J1L1J0b1R1T1P0b0F1s0b0r0?1e0o0U0X0T0|0f011V1F010J0:0O0T0X0D0O1P1=1@1|1X1 1T2224110a0N0y0F0Z0U0Z0o0w1h0T0N0,1:0F0F0O0*2p1k270T1s0h1.2C1+1-1,1Q0C290|1L0T212m1P1A1C0@1W2M0w2O0T0Z2S1P0U2v1s2A2C2*141?2q2U1}2Z0F180c110N0e2z2.122-282:1X2=2@2_0f2|1@2~2A2L01330X2^040N0!372B133a310|3d3f0N0%3j392.3b3p2_0V3t3l3v3n3c0Z2?3e2_0x3A2 2/1E323F343g0H3K3m3N3o3P3H3g0R3T3C3V3E3G3q0q3#303%3x040e0E3,3M2V3(3Q0e2{1l2}3B3-3^3/0e363}383 3@2;3X3f0e3i453k3L3w4a110e3s4e3u40493)4j3z4m474h4q3:3J4t4g3D423S4z3U414i3:3!4E3$4G4w0e3+4K4o3O4w0f3=4Q484S3Q0f3|2*4u4B4H0f444$4A3.4)4d4,4F4p4Z4l4;4L4?3Y0f4s4_4R3W4T4y4 4X514Z4D544v4Z4J594(4T4P5d4.4w0!4V5h4M3Q0!4#3~4-5n3Y0!4+5r4=4Y5u4:5x4`5z3f0!4^5C503_5u4~5I555K5F535N5a5u582}1v2(1k2S2F0C1-2K3D0*2!251s5!1t5Y2,4m055*0,2)5D0|0#0T110w0D2l0F0b3t0N5s2;5}040*0o0i3?3w115*170s2O0o64661X0Z110G6l5y0|10040A0m6d3D0#110p2o0r6r5`3c0K112k213t6m6t110W6M6s3c112b0O6R6G6o046q5=6S0o1`04020t0s0Z0b0(2l0U0$1H0o0b0l6a0i6+6-6/6X5J6u0Q6F5J680D5+705O6Z6#2,6%6)6}6.0(0F7g6 6$6G72745O68215@2X0k793b7b7w3D6(117k0(1g0J0B0R7D7z3%6u0L7p3b6A040_7O4B6U0w0*1H0O0F7K3^6u0P3A0N7*656S681T2x0O0s7!4m7,6Y6p7T3.6f6b7#1}6Z0l7 32110M7W0b0S0O0X0,7?7d7n6P833o7V7X0w7Z8h017o7@6N6T040,1L0D2o8m7m5J7y8z5O7B6*6,7h0(7J8C3b7M7)7+8r7Q0J3F7{4111211+0O6W8q6S0Z0p5~1j8!6G7.2w0b7;8d5W6S7%8N7+8O6S8Q8S8*75110,0o0*0F0 8.7=8T808%042X9784048W2v8Z8e71117(4t8^9n8_6G7Q0w0J9c8i8t0O91930U958:387^8A992Z638}7a999b9J8L110A8n8E7D0,1?620O240T0b8J9i5O8p2*9E8D7f8G6/2Z0D9#8;8f040m9l4$9o9{9p8~9e9Z9g8n6u9Q8K7U9w9y948/a2116x9N3D8B9)8r0T6I9a9Zab046Qa57|9 8X9h9=9j6v8n689092a996aq7$ac7N9m9{ai6f0Z6h6j8n81ay110X0U0U210Canap9$6easa1aE1}8M4t4%3%0*0e11030N1.0j0O0)0N9x0b0N0^a}0w6^1U5*9Z211@a|1T0=9f0z9x2r1i9I5m1}a.a:a}1U9/2r1Ua~6g0D6i1Ua{0N0n0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