Quiffen
========
.. content
Quiffen is a Python package for parsing QIF (Quicken Interchange Format) files.
The package allows users to both read QIF files and interact with the contents, and also to create a QIF structure
and then output to either a QIF file, a CSV of transaction data or a pandas DataFrame.
QIF is an old file type, but has its merits because:
- It's standardised (apart from dates, but that can be dealt with)
- Unlike CSVs, QIF files all follow the same format, so they don't require special attention when they come from
different sources
- It's written in plain text
Features
--------
- Import QIF files and manipulate data
- Create QIF structures (support for Transactions, Investments, Accounts, Categories, Classes, Splits)
- Convert Qif objects to a number of different formats and export (pandas DataFrame, CSV, QIF file)
Usage
------
Here's an example parsing of a QIF file:
>>> from quiffen import Qif, QifDataType
>>> import decimal
>>> qif = Qif.parse('test.qif', day_first=False)
>>> 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']
>>> acc.transactions
{'Bank': TransactionList(Transaction(date=datetime.datetime(2021, 2, 14, 0 , 0), amount=decimal.Decimal(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)
>>> qif.categories
{'Bills': Category(name='Bills), expense=True, hierarchy='Bills'}
>>> bills = qif.categories['Bills']
>>> print(bills.render_tree())
Bills (root)
└─ Cell Phone
>>> df = qif.to_dataframe(data_type=QifDataType.TRANSACTIONS)
>>> 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
...
And here's an example of creating a QIF structure and exporting to a QIF file:
>>> import quiffen
>>> from datetime import datetime
>>> qif = quiffen.Qif()
>>> acc = quiffen.Account(name='Personal Bank Account', desc='My personal bank account with Barclays.')
>>> qif.add_account(acc)
>>> groceries = quiffen.Category(name='Groceries')
>>> essentials = quiffen.Category(name='Essentials')
>>> groceries.add_child(essentials)
>>> qif.add_category(groceries)
>>> tr = quiffen.Transaction(date=datetime.now(), amount=150.0)
>>> acc.add_transaction(tr, header=quiffen.AccountType.BANK)
>>> qif.to_qif() # If a path is provided, this will save the file too!
'!Type:Cat\nNGroceries\nETrue\nIFalse\n^\nNGroceries:Essentials\nETrue\nIFalse\n^\n!Account\nNPersonal Bank Account\nDMy
personal bank account with Barclays.\n^\n!Type:Bank\nD02/07/2021\nT150.0\n^\n'
Documentation
-------------
Documentation can be found at: https://quiffen.readthedocs.io/en/latest/
Installation
------------
Install Quiffen by running:
>>> pip install quiffen
Dependencies
------------
- `pandas <https://pypi.org/project/pandas/>`_ (optional) for exporting to DataFrames
- The ``to_dataframe()`` method will not work without pandas installed.
To-Dos
------
- Add support for the ``MemorizedTransaction`` object present in QIF files.
Contribute
----------
GitHub pull requests welcome, though if you want to make a major change, please open an issue first for discussion.
- Issue Tracker: https://github.com/isaacharrisholt/quiffen/issues
- Source Code: https://github.com/isaacharrisholt/quiffen
Support
-------
If you are having issues, please let me know.
License
-------
The project is licensed under the GNU GPLv3 license.
Raw data
{
"_id": null,
"home_page": "https://github.com/isaacharrisholt/quiffen",
"name": "quiffen",
"maintainer": null,
"docs_url": null,
"requires_python": "<4.0,>=3.8",
"maintainer_email": null,
"keywords": "qif, finance, data processing",
"author": "Isaac Harris-Holt",
"author_email": "isaac@harris-holt.com",
"download_url": "https://files.pythonhosted.org/packages/29/97/83ecd2fc1898563ce4daa7f6f45ec826f355f15ceb6809ddc124f166fcf4/quiffen-2.0.12.tar.gz",
"platform": null,
"description": "Quiffen\n========\n\n.. content\n\nQuiffen is a Python package for parsing QIF (Quicken Interchange Format) files.\n\nThe package allows users to both read QIF files and interact with the contents, and also to create a QIF structure\nand then output to either a QIF file, a CSV of transaction data or a pandas DataFrame.\n\nQIF is an old file type, but has its merits because:\n\n- It's standardised (apart from dates, but that can be dealt with)\n\n - Unlike CSVs, QIF files all follow the same format, so they don't require special attention when they come from\n different sources\n\n- It's written in plain text\n\nFeatures\n--------\n\n- Import QIF files and manipulate data\n- Create QIF structures (support for Transactions, Investments, Accounts, Categories, Classes, Splits)\n- Convert Qif objects to a number of different formats and export (pandas DataFrame, CSV, QIF file)\n\nUsage\n------\n\nHere's an example parsing of a QIF file:\n\n>>> from quiffen import Qif, QifDataType\n>>> import decimal\n>>> qif = Qif.parse('test.qif', day_first=False)\n>>> qif.accounts\n{'Quiffen Default Account': Account(name='Quiffen Default Account', desc='The default account created by Quiffen when no\nother accounts were present')}\n>>> acc = qif.accounts['Quiffen Default Account']\n>>> acc.transactions\n{'Bank': TransactionList(Transaction(date=datetime.datetime(2021, 2, 14, 0 , 0), amount=decimal.Decimal(150.0), ...), ...),\n'Invst': TransactionList(...)}\n>>> tr = acc.transactions['Bank'][0]\n>>> print(tr)\nTransaction:\n Date: 2020-02-14 00:00:00\n Amount: 67.5\n Payee: T-Mobile\n Category: Cell Phone\n Split Categories: ['Bills']\n Splits: 2 total split(s)\n>>> qif.categories\n{'Bills': Category(name='Bills), expense=True, hierarchy='Bills'}\n>>> bills = qif.categories['Bills']\n>>> print(bills.render_tree())\nBills (root)\n\u2514\u2500 Cell Phone\n>>> df = qif.to_dataframe(data_type=QifDataType.TRANSACTIONS)\n>>> df.head()\n date amount payee ... memo cleared check_number\n0 2020-02-14 67.5 T-Mobile ... NaN NaN NaN\n1 2020-02-14 32.0 US Post Office ... money back for damaged parcel NaN NaN\n2 2020-12-02 -10.0 Target ... two transactions, equal NaN NaN\n3 2020-11-02 -25.0 Walmart ... non split transaction X 123.0\n4 2020-10-02 -100.0 Amazon.com ... test order 1 * NaN\n...\n\nAnd here's an example of creating a QIF structure and exporting to a QIF file:\n\n>>> import quiffen\n>>> from datetime import datetime\n>>> qif = quiffen.Qif()\n>>> acc = quiffen.Account(name='Personal Bank Account', desc='My personal bank account with Barclays.')\n>>> qif.add_account(acc)\n>>> groceries = quiffen.Category(name='Groceries')\n>>> essentials = quiffen.Category(name='Essentials')\n>>> groceries.add_child(essentials)\n>>> qif.add_category(groceries)\n>>> tr = quiffen.Transaction(date=datetime.now(), amount=150.0)\n>>> acc.add_transaction(tr, header=quiffen.AccountType.BANK)\n>>> qif.to_qif() # If a path is provided, this will save the file too!\n'!Type:Cat\\nNGroceries\\nETrue\\nIFalse\\n^\\nNGroceries:Essentials\\nETrue\\nIFalse\\n^\\n!Account\\nNPersonal Bank Account\\nDMy\npersonal bank account with Barclays.\\n^\\n!Type:Bank\\nD02/07/2021\\nT150.0\\n^\\n'\n\nDocumentation\n-------------\n\nDocumentation can be found at: https://quiffen.readthedocs.io/en/latest/\n\nInstallation\n------------\n\nInstall Quiffen by running:\n\n>>> pip install quiffen\n\nDependencies\n------------\n\n- `pandas <https://pypi.org/project/pandas/>`_ (optional) for exporting to DataFrames\n\n - The ``to_dataframe()`` method will not work without pandas installed.\n\nTo-Dos\n------\n\n- Add support for the ``MemorizedTransaction`` object present in QIF files.\n\nContribute\n----------\n\nGitHub pull requests welcome, though if you want to make a major change, please open an issue first for discussion.\n\n- Issue Tracker: https://github.com/isaacharrisholt/quiffen/issues\n- Source Code: https://github.com/isaacharrisholt/quiffen\n\nSupport\n-------\n\nIf you are having issues, please let me know.\n\nLicense\n-------\n\nThe project is licensed under the GNU GPLv3 license.\n",
"bugtrack_url": null,
"license": "GPL-3.0-or-later",
"summary": "Quiffen",
"version": "2.0.12",
"project_urls": {
"Documentation": "https://quiffen.readthedocs.io/en/latest/",
"Homepage": "https://github.com/isaacharrisholt/quiffen",
"Repository": "https://github.com/isaacharrisholt/quiffen"
},
"split_keywords": [
"qif",
" finance",
" data processing"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "1d4c21b49f195fb69d42d4914f8fd7ed1833a5e1af071412c4caf6f7d2c059dd",
"md5": "d83b9bdd748e010b57e05db4e234ea41",
"sha256": "bdff37a8ad7beb06358534669a5fe70d18cf0f5a6989d16d7141ab553f057de6"
},
"downloads": -1,
"filename": "quiffen-2.0.12-py3-none-any.whl",
"has_sig": false,
"md5_digest": "d83b9bdd748e010b57e05db4e234ea41",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<4.0,>=3.8",
"size": 30811,
"upload_time": "2024-11-03T12:29:57",
"upload_time_iso_8601": "2024-11-03T12:29:57.883182Z",
"url": "https://files.pythonhosted.org/packages/1d/4c/21b49f195fb69d42d4914f8fd7ed1833a5e1af071412c4caf6f7d2c059dd/quiffen-2.0.12-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "299783ecd2fc1898563ce4daa7f6f45ec826f355f15ceb6809ddc124f166fcf4",
"md5": "bf541891f678284d5c3b4475e9b4c0e6",
"sha256": "a508c9a9ee413be6268df30bc3eff0331b960b5d1cb0760288b2483fd8397630"
},
"downloads": -1,
"filename": "quiffen-2.0.12.tar.gz",
"has_sig": false,
"md5_digest": "bf541891f678284d5c3b4475e9b4c0e6",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<4.0,>=3.8",
"size": 24358,
"upload_time": "2024-11-03T12:29:59",
"upload_time_iso_8601": "2024-11-03T12:29:59.401757Z",
"url": "https://files.pythonhosted.org/packages/29/97/83ecd2fc1898563ce4daa7f6f45ec826f355f15ceb6809ddc124f166fcf4/quiffen-2.0.12.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-03 12:29:59",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "isaacharrisholt",
"github_project": "quiffen",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "quiffen"
}