Created
August 5, 2018 18:13
-
-
Save Debilski/40d02796875b23d7aef160895985ce67 to your computer and use it in GitHub Desktop.
Convert pecunia csv to moneymoney
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
import pandas as pd | |
# This needs to be exported from Pecunia (in that order!) | |
names = [ | |
'Datum', # Called 'Buchungsdatum' in Pecunia | |
'Wertstellung', # 'Valutadatum' | |
'Kategorien', | |
'Name', # 'Empfänger' | |
'Verwendungszweck', | |
'IBAN Empfänger', | |
'BIC Empfänger', | |
'Betrag', # 'Wert', | |
'Währung', | |
'Empfängerkonto', | |
'Bankleitzahl Empfängerbank' | |
] | |
transactions = pd.read_csv('Pecunia-export.csv', delimiter=';', names=names, index_col=False) | |
# We now take into account that some Pecunia transactions have an empty IBAN or BIC; | |
# in that case we default to the 'Empfängerkonto' and 'Bankleitzahl' respectively. | |
# MoneyMoney expects these as 'Konto' and 'Bank' so we create new columns. | |
transactions['Konto'] = transactions['IBAN Empfänger'].combine_first(pec['Empfängerkonto']) | |
transactions['Bank'] = transactions['BIC Empfänger'].combine_first(pec['Bankleitzahl Empfängerbank']) | |
# Export again: | |
transactions.to_csv('Pecunia-converted.csv') | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment