Im trying to get the number max of a category of a csv file, but i cant get why my fonction is not working
import csv
file = open("serieschrono-datagouv.csv", "r", encoding="utf8")
reader = csv.reader(file, delimiter=";")
table =[]
for row in reader:
ligne = []
for i in row:
ligne.append(i)
table.append(ligne)
file.close()
def maximum(liste, donnée):
maxi = liste[1][0]
for i in range(1,len(liste)):
if liste[i][2]==str(donnée):
if liste[i][0] !='NA':
if maxi < liste[i][0]:
maxi = liste[i][0]
return maxi
BTW the image is the csv file
I tryed to change a lot of things in the fonction