Skip to content

Instantly share code, notes, and snippets.

@tdhopper
Last active August 29, 2015 14:01
Show Gist options
  • Save tdhopper/afd0914a527d2ceff149 to your computer and use it in GitHub Desktop.
Save tdhopper/afd0914a527d2ceff149 to your computer and use it in GitHub Desktop.
Script to convert exported CSV from Simple (simple.com) into a format compatible with YNAB (ynab.com).
import pandas as pd
trans = pd.read_csv("2014-05-06-exported_transactions.csv", parse_dates=[0])
trans = trans[trans.Pending == False]
trans = trans[["Date","Amount","Description","Memo"]]
trans = trans.copy(deep=True)
trans["Inflow"] = trans.Amount.map(lambda x: x if x > 0 else 0)
trans["Outflow"] = trans.Amount.map(lambda x: -x if x <= 0 else 0)
del trans["Amount"]
trans["Payee"] = trans["Description"]
del trans["Description"]
trans["Category"] = ""
trans.Memo.fillna("", inplace=True)
trans = trans[["Date","Payee","Category","Memo","Outflow","Inflow"]]
trans["Date"] = trans.Date.map(lambda date: date.strftime("%m/%d/%y"))
trans = trans[trans.Payee.str.contains("Check Hold") == False]
trans.to_csv("to_ynab.csv", index=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment