Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23218

my Maximum fonction is not returning me the good number [closed]

$
0
0

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 csvfile = 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


Viewing all articles
Browse latest Browse all 23218

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>