Hello. I’m trying to copy a selection of rows from a csv created earlier in my experiment to a new csv to be used as a conditions file later in the experiment.
This is the closest I’ve gotten to making it work:
with open('~/Desktop/olddata.csv', "r") as csvfile, open('~/Desktop/newdata.csv", "w") as csvfile_out : reader = csv.reader(csvfile, delimiter = ',') writer = csv.writer(csvfile_out, delimiter = ',') for row in reader: writer.writerow(row, row, row)
Instead of copying over the selected rows, it appears to have copied all of the rows from the columns of those respective numbers (e.g., column 1, column 10, and column 19). I assume it’s just a matter of adjusting the csv function but I haven’t had any luck trying to fix it.
Any help pointing me in the right direction would be greatly appreciated!