Skip to content

Instantly share code, notes, and snippets.

@isaacharrisholt
Created July 5, 2021 13:11
Show Gist options
  • Save isaacharrisholt/7190e4ec1ad634c2caccdbf0a1c2b1bb to your computer and use it in GitHub Desktop.
Save isaacharrisholt/7190e4ec1ad634c2caccdbf0a1c2b1bb to your computer and use it in GitHub Desktop.
from quiffen import Qif
qif = Qif.parse('test.qif')
print(qif.accounts)
# {'Quiffen Default Account': Account(name='Quiffen Default Account', desc='The default account created by Quiffen when no
# other accounts were present')}
acc = qif.accounts['Quiffen Default Account']
print(acc.transactions)
# {'Bank': TransactionList(Transaction(date=datetime.datetime(2021, 2, 14, 0 , 0), amount=150.0, ...), ...),
# 'Invst': TransactionList(...)}
tr = acc.transactions['Bank'][0]
print(tr)
# Transaction:
# Date: 2020-02-14 00:00:00
# Amount: 67.5
# Payee: T-Mobile
# Category: Cell Phone
# Split Categories: ['Bills']
# Splits: 2 total split(s)
df = qif.to_dataframe(data='transactions')
print(df.head())
# date amount payee ... memo cleared check_number
# 0 2020-02-14 67.5 T-Mobile ... NaN NaN NaN
# 1 2020-02-14 32.0 US Post Office ... money back for damaged parcel NaN NaN
# 2 2020-12-02 -10.0 Target ... two transactions, equal NaN NaN
# 3 2020-11-02 -25.0 Walmart ... non split transaction X 123.0
# 4 2020-10-02 -100.0 Amazon.com ... test order 1 * NaN
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment