I have a master csv file in the form
col1, col2, col3, col4...
a, x, y, z
a, x, y, z
b, x, y, z
b, x, y, z
.. .. .. ..
and I want to read this file in. Create a new Excel file with all values where col1==a and another file with all values where col1==b. So OutputFilea will look like:
col1, col2, col3, col4...
a, x, y, z
a, x, y, z
and OutputFileb will look like
col1, col2, col3, col4...
b, x, y, z
b, x, y, z
My question is, should I use csv.reader() line by line and use conditionals to determine which file should be appended or should I append a string with the rows and then write each file at the end. Or is there a module which optimizes a process like this?