Created
June 24, 2019 00:30
-
-
Save heronyang/3ec2d8bc2c5ba1b5d2bb6e41cc9f0a71 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| INPUT = "merged_traffic_data.csv" | |
| OUTPUT = "merged_traffic_data_for_fusion.csv" | |
| with open(INPUT) as fin: | |
| with open(OUTPUT, 'w') as fout: | |
| is_first_line = True | |
| for line in fin: | |
| if is_first_line: | |
| fout.write(',location,death,injury,time\n') | |
| is_first_line = False | |
| continue | |
| s = line.split(',') | |
| s[1] = '"' + s[1] | |
| s[2] = s[2] + '"' | |
| fout.write(','.join(s)) | |
| print('Done') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment