feat: Initial commit
This commit is contained in:
35
EsRiassuntivi/qualità_della_vita/qdv.py
Normal file
35
EsRiassuntivi/qualità_della_vita/qdv.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import csv
|
||||
|
||||
with open("20201214_QDV2020_001.csv") as csv_file:
|
||||
csv_reader = csv.reader(csv_file)
|
||||
|
||||
line_count = 0
|
||||
|
||||
rows = []
|
||||
indc = set()
|
||||
|
||||
for row in csv_reader:
|
||||
if line_count == 0:
|
||||
print(f'Column names are {", ".join(row)}')
|
||||
line_count += 1
|
||||
else:
|
||||
row_a = {"provincia": row[0], "valore": row[4], "indicatore": row[5]}
|
||||
indc.add(row[5])
|
||||
rows.append(row_a)
|
||||
|
||||
indc = list(indc)
|
||||
print("Indicatori della qualità della vita:")
|
||||
for i in range(len(indc)):
|
||||
print(str(i+1) + ".", indc[i])
|
||||
|
||||
while True:
|
||||
indic = input("Inserisci l'indicatore: ")
|
||||
|
||||
if indic == "quit":
|
||||
break
|
||||
|
||||
indic = indc[int(indic)]
|
||||
|
||||
rows_filtered = {}
|
||||
for r in rows:
|
||||
if r["indicatore"] == indic
|
||||
Reference in New Issue
Block a user