Skip to content

Instantly share code, notes, and snippets.

@danieroux
Created April 6, 2016 19:47
Show Gist options
  • Save danieroux/a77f02592c12455148ff673c001a05e0 to your computer and use it in GitHub Desktop.
Save danieroux/a77f02592c12455148ff673c001a05e0 to your computer and use it in GitHub Desktop.
import csv
def invert(filename):
with open(filename + ".csv", "rb") as csvfile:
reader = csv.reader(csvfile, delimiter=",", quotechar='"')
with open(filename + "_inverted.csv", "wb") as csvfilew:
writer = csv.writer(csvfilew, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
first_done = False
for row in reader:
if first_done:
row[1] = float(row[1]) * -1
first_done = True
writer.writerow(row)
invert("20140305-20150511-for-xero-import-new-cols")
invert("20150406-20150304-from-pdf-statements-rewritten")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment