-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathremovecity.py
More file actions
42 lines (30 loc) · 773 Bytes
/
removecity.py
File metadata and controls
42 lines (30 loc) · 773 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
35
36
37
38
39
40
41
42
import string
from random import randint
file = open("data.csv","r")
olines = file.readlines()
nf = open("withwy.csv","w")
#nlines = []
#nlines += olines[0]
#used = []
#for i in range(1,20000):
# nrand = randint(0,1482000)
# while(nrand in used):
# nrand = randint(0, 1482000)
# used += [nrand]
# print(nrand)
# nlines += [olines[nrand]]
#nf.writelines(nlines)
lines = file.readlines();
newlines = []
for i,line in enumerate(lines):
if i % 10000 == 0:
print("%d of 1482000 (%.1f%%)" % (i, i/1482000))
stuff = line.split(",")
newline = []
for i in range(0,len(stuff)):
if (i != 5):
newline += [stuff[i]]
newline = ','.join(newline)
newlines += [newline]
nf.writelines(newlines)
nf.close()