Skip to main content

Finparse

pypi python pytest coverage maintainability

Parse financial strings to number objects

Installation

pip install finparse

Usage

import finparse

finparse.parse("$1,234,567.89")
# => 1234567.89

finparse.parse("€1.234.567,89", decimal=",")
# => 1234567.89

finparse.parse("($1,234,567.89)")
# => -1234567.89

import decimal

finparse.parse("$1,234,567.89", cast=decimal.Decimal)
# => Decimal('1234567.89')

Pandas

Pandas' read_csv() function provdides a converters argument that applies a function to the given column.

Using the example CSV file ./tests/example.csv, we can see the following behavior:

import pandas

df = pandas.read_csv('./tests/example.csv')

print(df)
# =>        Acct     Balance
#    0   Savings  $1,234.567
#    1  Checking    ($0.987)

With the converters argument we can parse these values to floats:

import finparse
import pandas

df = pandas.read_csv('./tests/example.csv', converters={'Balance': finparse.parse})

print(df)
# =>        Acct   Balance
#    0   Savings  1234.567
#    1  Checking    -0.987

Metadata

Release files for finparse 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for finparse 0.2.0
File Size Uploaded Provenance Actions
finparse-0.2.0.tar.gz 4.9 kB Without provenance Details for finparse-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for finparse 0.2.0
File Interpreter ABI Platform Actions
finparse-0.2.0-py3-none-any.whl Python 3 none any Details for finparse-0.2.0-py3-none-any.whl

Total release size: 8.1 kB

Release files / finparse-0.2.0.tar.gz

Download URL finparse-0.2.0.tar.gz
Size 4.9 kB
Tags Source
SHA-256 checksum
How to use checksums
468d4de18a20e0da972fd41baab8b995080fc60a1a935878a92bbcce13d6fe13
BLAKE2b-256 checksum
How to use checksums
200fa8e772da441c5a69a2f8efd80611cffce043b6e6edcc8644f29febf4f282
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Release files / finparse-0.2.0-py3-none-any.whl

Download URL finparse-0.2.0-py3-none-any.whl
Size 3.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
211236becaa4538bc3238cbd905605739dcbf147f506aae3d230205bd31e2d3a
BLAKE2b-256 checksum
How to use checksums
0c1c1b73a9b1d84b3de5164d4c9fae0780182dd24ec60f2afa279f026139d3f8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.31.0

Security for finparse 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page