I am trying to find the MIN and MAX values for each row of a CSV file and append them to the next position in the list, positions 5 and 6. I have managed to calculate the average, append this to the forth position and output this in highest to lowest however, I am struggling to work out how to find the MAX and MIN values of each row so I can do the same - highest to lowest. The original CSV is formatted: Fred,56,78,99 with each user on a new line.
Any help would be appreciate.
import csv
import operator
sample = open("sampleData.txt", "r")
csv1 = csv.reader(sample, delimiter = ',')
sort = sorted(csv1,key=operator.itemgetter(0))
for i in range( 0, len(sort)):
sort[i].append((int(sort[i][1]) + int(sort[i][2]) + int(sort[i][3])) / int(len(sort[i])-1))
sort = list(reversed(so