Last active
October 29, 2015 09:20
-
-
Save dvas0004/4aad17ccf1a1c273ca41 to your computer and use it in GitHub Desktop.
Convert csv to ascii
This file contains 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
import csv | |
with open('log_transformed_truncated.csv', 'w') as outfile: | |
c = csv.writer(outfile) | |
counter = 0 | |
with open('log_prepared_truncated.csv','rb') as f: | |
for row in csv.reader(f, delimiter=','): | |
counter = counter + 1 | |
mod_row = [] | |
if counter != 1: | |
for cell in row: | |
mod_row.append(sum(bytearray(cell))) | |
else: | |
for cell in row: | |
mod_row.append(cell) | |
c.writerow(mod_row) | |
print "processed {} rows".format(counter) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment