finparse-0.1.4
توضیحات
Module to parse a number-string to a float or decimal.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | finparse-0.1.4 |
| نام | finparse |
| نسخه کتابخانه | 0.1.4 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Alexander Mancevice <alexander.mancevice@hey.com> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/finparse/ |
| مجوز | - |
# Finparse


[](https://github.com/amancevice/finparse/actions)
[](https://codeclimate.com/github/amancevice/finparse/test_coverage)
[](https://codeclimate.com/github/amancevice/finparse/maintainability)
Parse financial strings to number objects
## Installation
```bash
pip install finparse
```
## Usage
```python
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`](./tests/example), we can see the following behavior:
```python
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:
```python
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
```
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >= 3.7 | Python |
نحوه نصب
نصب پکیج whl finparse-0.1.4:
pip install finparse-0.1.4.whl
نصب پکیج tar.gz finparse-0.1.4:
pip install finparse-0.1.4.tar.gz