quiffen package

Submodules

quiffen.utils module

quiffen.utils.add_custom_field_to_object_dict(field: str, custom_fields: List[Field], object_dict: Dict[str, Any]) Tuple[Dict[str, Any], bool]

Add custom QIF fields to a dict representing a Quiffen object based on the QIF file line.

Returns
object_dictdict

The object dict with the custom field added.

foundbool

Whether the custom field was found.

quiffen.utils.apply_csv_formatting_to_container(obj: Union[List[Any], Dict[Any, Any]], date_format: Optional[str] = '%Y-%m-%d') Union[List[Any], Dict[Any, Any], Any]

Recursively apply CSV-friendly formatting to a container

quiffen.utils.apply_csv_formatting_to_scalar(obj: Any, date_format: Optional[str] = '%Y-%m-%d', stringify: bool = False) Any

Apply CSV-friendly formatting to a scalar value

quiffen.utils.convert_custom_fields_to_qif_string(custom_fields: List[Field], obj: Any) str

Convert custom fields to a QIF string.

quiffen.utils.parse_date(date_string: str, day_first: bool = False) datetime

Parse a string date of an unknown format and return a datetime object.

Parameters
date_stringstr

String containing date found in QIF file

day_firstbool, default=False

Whether the day comes first in the date (e.g. UK date) or after the month (e.g. US date)

Returns
datetime.datetime

datetime object with the date data from the date_string parameter.

Raises
ValueError

If the date cannot be parsed.

quiffen.utils.parse_decimal(value: Union[str, Decimal]) Decimal

Parse a decimal from a string, removing non-numeric characters.

quiffen.utils.parse_line_code_and_field_info(field: str) Tuple[str, str]

Parse a QIF field into a line code and field info.

Module contents

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.