-
Notifications
You must be signed in to change notification settings - Fork 1
/
cleandataall_delete_empty_comm_again.py
18 lines (16 loc) · 16.5 KB
/
cleandataall_delete_empty_comm_again.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import csv
# 0 ID,1 Case Number,2 Date,3 Block,4 IUCR,5 Primary Type,6 Description
# 7 Location Description,8 Arrest,9 Domestic,10 Beat,11 District,12 Ward,
# 13 Community Area,14 FBI Code,15 X Coordinate,16 Y Coordinate,17 Year,
# 18 Updated On,19 Latitude,20 Longitude,21 Location
f = open('CrimesAll_final.csv', 'rb')
res = open('CrimesAll_final_final.csv', 'wb')
csvread = csv.reader(f)
csvwrite = csv.writer(res)
count = 0
atLine = 0
for line in csvread:
atLine+=1
if (cmp(line[4],'')==0) or (cmp(line[4],' ')==0):
continue
csvwrite.writerow(line)