I want to delete 90% of rows which have "steering" value qual to 0. And there is a corresponding image file for all three f them, center, left and right. I want to delete them too. The csv file is like this:
I have written the following code to at least get the files which have steering value 0. All I need is the code to randomly get 90% of those files and delete them.
with open('data/driving_log.csv') as csvfile:
reader = csv.reader(csvfile)
for i,line in enumerate(reader):
lines.append(line)
index.append(i)
lines = np.delete(lines,(0), axis = 0)
for i, line in enumerate(lines):
#print(type(line[3].astype(np.float)))
line_no.append(line[3].astype(np.float32))
#print(line_no[i])
if line_no[i]==0.0:
# this gets the first column of the row.
for j in range(3):
source_path = line[j]
filename = source_path.split('/')[-1]
print(filename)
count += 1