Skip to main content

Style Status Docs Status Tests Status Top Language Status Code Style Documentation PyPI Latest Release PyPI Downloads


babilonia

Handle accounting and finances in Brazil using Python.


Install

python -m pip install babilonia

Quick Gallery

API

Parse bank statement CSV

Convert raw bank exports to a canonical pandas.DataFrame.

Input (extrato_poupanca.csv from Banco do Brasil):

"Data","Histórico","Valor",
"01/08/2025","Juros","3,83 C",
"01/08/2025","Reajuste Monetário - BACEN","16,67 C",
"11/08/2025","Transferência de Crédito","1.000,00 C",
from babilonia.accounting import CashFlowBBPP

cf = CashFlowBBPP()
cf.load_data("./extrato_poupanca.csv")
cf.standardize()
print(cf.data)
        Data    Valor                   Categoria Descricao
  2025-08-01     3.83                       Juros
  2025-08-01    16.67  Reajuste Monetário - BACEN
  2025-08-11  1000.00    Transferência de Crédito

Supported account types: CashFlowBBCC, CashFlowBBCCPJ, CashFlowBBPP, CashFlowNUCredit.


Cash flow analysis

Compute monthly and yearly summaries from a canonical cash flow file.

from babilonia.accounting import CashFlow

cf = CashFlow()
cf.load_data("./caixa_diario.csv")

dc = CashFlow.get_cashflow_report(df=cf.data, year=2025, initial_cash=5000.0)
print(dc["Summary"])
print(dc["Pannel"])
   Ano   Categoria     Total     Media  % Entradas
  2025    ENTRADAS  18200.00   1516.67      100.00
  2025      SAIDAS  -9430.00   -785.83       51.81
  2025     Moradia  -3200.00   -266.67       17.58
  2025  Alimentacao  -1800.00   -150.00        9.89

   Mes  Entradas   Saidas    Fluxo      Saldo
2025-01   1500.0  -780.0    720.0     5720.0
2025-02   1500.0  -810.0    690.0     6410.0
     ...

Parse NFSe XML

Load and inspect a Nota Fiscal de Serviços Eletrônica from nfse.gov.br.

from babilonia.accounting import NFSe

nf = NFSe()
nf.load_data("./nfse.xml")
print(nf.date)           # '2025-09-01'
print(nf.emitter)        # '27543216700666 -- PRESTADOR LTDA'
print(nf.taker)          # '07704429000666 (CNPJ) -- TOMADOR LTDA'
print(nf.service_value)  # 6666.0

Batch-load NFSe files

Aggregate a folder of NFSe XML files into a single catalog.

from babilonia.accounting import NFSeColl

coll = NFSeColl()
coll.load_folder("./notas_fiscais/")
print(coll.catalog[["name", "Date", "ValorServico", "Prestador"]])
          name        Date  ValorServico                          Prestador
  NFSe_NF0080  2025-09-01        6666.0  27543216700666 -- PRESTADOR LTDA
  NFSe_NF0081  2025-10-01        5000.0  27543216700666 -- PRESTADOR LTDA

Command-line tools

The babilonia.tools scripts form a processing pipeline: raw exports → standardized files → cash flow reports.

Standardize raw bank exports

Reads T0 raw CSV files and writes T1 canonical CSVs in the same folder tree.

python -m babilonia.tools.parse --folder ./data --type bb-cc --year 2025

Available --type values: bb-cc, bb-pp, bb-ccpj, bb-cdb, nubank-credito.


Build cash flow reports

Aggregates T1 files into daily, monthly, and annual summaries. Omit --year to process all years.

python -m babilonia.tools.cashflow --folder ./data --type bb-cc

Categorize and report by label

Fills the Categoria column using a keyword dictionary, then prints and exports a monthly breakdown by category.

python -m babilonia.tools.categorize --folder ./data --type nubank-credito --year 2025

Yearly cash flow report

Reads the consolidated daily file and prints a formatted yearly panel and category summary.

python -m babilonia.tools.report --folder ./data --type bb-cc --year 2025

Metadata

Release files for babilonia 1.0.7

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

Source distribution (sdist)

Source distribution for babilonia 1.0.7
File Size Uploaded Provenance Actions
babilonia-1.0.7.tar.gz 132.6 kB Without provenance Details for babilonia-1.0.7.tar.gz

Built distribution (wheel)

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

Total release size: 200.4 kB

Release files / babilonia-1.0.7.tar.gz

Download URL babilonia-1.0.7.tar.gz
Size 132.6 kB
Tags Source
SHA-256 checksum
How to use checksums
06307085b9004710b4079af8e13e1882e5b8eb5fcecad19959f3fcc68450b747
BLAKE2b-256 checksum
How to use checksums
d2409bac8bf256861b58a1d9f7ac4e247a3687eec7ab46b421527eca8ec39de3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Release files / babilonia-1.0.7-py3-none-any.whl

Download URL babilonia-1.0.7-py3-none-any.whl
Size 67.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2a65763c1549e619895d3300d3fc8b5c34fcef2b9a16a2b8ea2439a884030b5e
BLAKE2b-256 checksum
How to use checksums
bae75969ad68cc53a03450423c90f0d7cbf7a0c8917e69bf3a4945d28ccdc77e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.17

Security for babilonia 1.0.7

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