Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save toshihiroryuu/e41b42173589019f1a45db7cb7bbb058 to your computer and use it in GitHub Desktop.
Save toshihiroryuu/e41b42173589019f1a45db7cb7bbb058 to your computer and use it in GitHub Desktop.
import csv
PATH='/home/udacity_driving_datasets'
f1 = open('/home/quest/train.csv')
csv_f = csv.reader(f1)
for row in csv_f:
name=row[0]
listt=''
listt='/home/udacity_driving_datasets/'+name
with open('/home/trainsample.csv', mode='a') as csv_file:
fieldnames = ['frame', 'xmin', 'xmax','ymin', 'ymax', 'class_id']
writer = csv.DictWriter(csv_file, fieldnames=fieldnames)
# writer.writeheader()
writer.writerow({'frame': listt, 'xmin': row[1], 'xmax': row[2], 'ymin': row[3], 'ymax': row[4], 'class_id':row[5]})
print("copies row")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment