I started using Python and have the following problems here.
Indentation Error with count +=1 and several other lines
Not scanning all .csv files in a directory. When I run this script, it only shows outputs of only one .csv file instead of multiple .csv file outputs on the first column. There must be an issue with for loop commands that I have.
I need to take the standard deviation of each line of the fileand take the mean value of standard deviation of all the lines in each file.
#!/usr/bin/env python import os print "Filename, Min, Max, Average, Mean of Std" for file in os.listdir("."): if not file.endswith(".csv"): continue csv = open(file) sum = 0 diff = 0 std = 0 sumstd = 0 count = 0 min = 0 max = 0 for line in csv.readlines(): x = line.split(",") time = x[0] value = float(x[1]) sum += value if value > max: max = value if 0 < value < min: min = value count += 1 avg = sum / count import math count +=1 diff += (value - avg)**2 std = math.sqrt (diff / (count+1)-1) sumstd += std meanstd = sumstd/count print file + "," + str(min) + "," + str(max) + "," + str(avg) + "," + str(meanstd)