I'm new in Python and I'm trying to get the average of every (column or row) of a csv file for then select the values that are higher than the double of the average of its column (o row). My file have hundreds of columns, and have float values like these:
845.123,452.234,653.23,...
432.123,213.452.421.532,...
743.234,532,432.423,...
I've tried several changes to my code to get the average for every column (separately), but at the moment my code is like this one:
def AverageColumn (c):
f=open(csv,"r")
average=0
Sum=0
column=len(f)
for i in range(0,column):
for n in i.split(','):
n=float(n)
Sum += n
average = Sum / len(column)
return 'The average is:', average
f.close()