So I have a number of CSV files with 6 columns of numbers in each file. I would like to perform a few operations (multiplication, division etc.) on each column in each of the CSV files using Python and instead of opening each file manually, I want to add the whole folder and perform the operations on them ALL AT ONCE.
import csv r = csv.reader(open('F:\python\sample.csv','rb')) w = csv.writer(open('F:\python\sample_calib.csv','wb',buffering=0)) for row in r: a = (float(row[0])-0.0376)/-0.0717 b = (float(row[1])-0.0376)/-0.0717 c = float(row[2])/1000 d = float(row[3])/1000 e = float(row[4])/1000000 f = float(row[5])/0.001178 w.writerow([a,b,c,d,e,f])
This is the script I am using to calibrate each row in each file and this works fine for each .csv file. Now all I want to do is to run this script for 200 FILES in one folder. Can some one tell me how should I edit the script and what modules to add?