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.9
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| babilonia-1.0.9.tar.gz | 173.5 kB | Without provenance | Details for babilonia-1.0.9.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| babilonia-1.0.9-py3-none-any.whl | Python 3 | none | any | Details for babilonia-1.0.9-py3-none-any.whl |
Total release size: 266.9 kB
Release files / babilonia-1.0.9.tar.gz
| Download URL | babilonia-1.0.9.tar.gz |
|---|---|
| Size | 173.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c93729183a11315e76326b20bc0bcac71ffa6a274be1871e39664d80ecfc87bd
|
|
BLAKE2b-256 checksum How to use checksums |
863e5e1167f5952bfb98b1cae10cc8a60d201d95517e62d60284c7faafda46e3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Release files / babilonia-1.0.9-py3-none-any.whl
| Download URL | babilonia-1.0.9-py3-none-any.whl |
|---|---|
| Size | 93.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
fb2828553367f43e8e396808d15e30610b21cd46319b7908f24c9655c2837061
|
|
BLAKE2b-256 checksum How to use checksums |
6b58bbce291bd7b76a8230197bb9aacb60fdb0dc54bd5c98e64e9284f42af195
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.18
|
Security for babilonia 1.0.9
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.