-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgenerate_csv.py
More file actions
34 lines (26 loc) · 766 Bytes
/
generate_csv.py
File metadata and controls
34 lines (26 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Generates a .csv with N rows, with (eid, description).
Execute:
python3 generate_csv N
"""
import csv
import sys
# n = sys.argv[1]
eid = 68000
ammount = 50000
final = eid + ammount
with open("/tmp/data.csv", "r") as src_file:
with open("data-{}.csv".format(ammount), "w") as data_file:
csv_writer = csv.writer(data_file)
csv_reader = csv.reader(src_file)
for i in range(5):
src_file.seek(0)
skip_header = True
for row in csv_reader:
if skip_header:
skip_header = False
continue
if eid == final:
break
csv_writer.writerow([eid, str(row[0])])
eid += 1