2025-03-22 00:49:46 +01:00

25 lines
795 B
Python

import csv
tab_donnees = []
nb_total = []
with open("arbres.csv", newline ='', encoding="utf-8") as csvfile:
donnees = csv.DictReader(csvfile, delimiter= ";")
for ligne in donnees:
tab_donnees.append(dict(ligne))
for ligne in tab_donnees:
ligne["HAUTEUR (m)"] = float(ligne["HAUTEUR (m)"])
for line in tab_donnees:
ligne["CIRCONFERENCEENCM"] = float(ligne["CIRCONFERENCEENCM"])
liste_abr = ['Aulne', 'Bouleau', 'Charme', 'Cyprès', 'Frêne', 'Noisetier de Byzance','Mûrier', 'Olivier', 'Platane']
nb_total = 0
abr_pollen = {}
for ligne in tab_donnees :
if ligne['LIBELLEFRANCAIS'] in liste_abr :
abr_pollen[ligne['LIBELLEFRANCAIS']]= abr_pollen.get(ligne['LIBELLEFRANCAIS'], 0)+1
nb_total += 1
print(tab_donnees[0])