samedi 27 juin 2020

Why is it unable to sum the profits? Is there a problem with the list values?

profits = 0
losses = 0
netprofits = 0


with open(csvpath) as csvfile:
    csvreader = csv.reader(csvfile, delimiter =',')
    csvheader = next(csvreader)

for row in csvreader:
    if (int(row[1])) > 0:
        profits += float(row[1])
    profits = (profits)
    print(sum(profits))

I keep getting an error that says it is unable to iterate the float() object. Any advice would be greatly appreciated.

Aucun commentaire:

Enregistrer un commentaire