I have a csv with 12288+1 coluns, and want to reduct to 4096+1 colums.
In this 12288+1 colums, they are same values on each three and the last value is a bit, 0 or 1.
I need to maintain a last value, and take just 1 for repetitive group of three.
And my original csv have 300 rows, or lines, whatever. I don't know how to do for catch others rows, and my script just take a first row/line.
from original csv 3,3,3,5,5,5,7,7,7,10,10,10 ... 20,20,20,50,50,50,1
want final csv 3,5,7,10 ... 20,50,1
import csv
count, num = 0
a = ''
with open('data.csv','rb') as filecsv:
reader = csv.reader(filecsv)
for row in reader:
while count < 12290:
a = a + str(row[:][count])+','
count = count + 3
num = num + 1
print num
print a
This prints just to have a idea.
Thanks for any help