Skip to main content

Handle accounting and finances in Brazil using Python

Project description

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.

[!NOTE] Check out the documentation website


Install easily

python -m pip install babilonia

Quick Gallery

Parse weird CSV bank statements

Convert CSV files sourced from banks to pandas.DataFrame.

Input (sourced statement from Banco do Brasil)

./extrato_poupanca.csv
    "Data","Histórico","Valor",
    "01/08/2025","Juros","3,83 C",
    "01/08/2025","Reajuste Monetário - BACEN","16,67 C",
    "01/08/2025","Juros","47,92 C",
    "11/08/2025","Transferência de Crédito","1.000,00 C",

Code block:

from babilonia.accounting import CashFlowBBPP
file_bb = "./extrato_poupanca.csv"
cf = CashFlowBBPP()
cf.load_data(file_bb)
cf.standardize()
print(type(cf.data))
print(cf)

Output:

<class 'pandas.core.frame.DataFrame'>
Data           Valor                   Categoria Descricao
2025-08-01      3.83                       Juros
2025-08-01     16.67  Reajuste Monetário - BACEN
2025-08-01     47.92                       Juros
2025-08-11   1000.00    Transferência de Crédito

Parse XML Fiscal Notes (NFSe)

Convert XML files sourced from nfse.gov.br as a Python dict.

Code block:

import pprint
from babilonia.accounting import NFSe
file_nfse = "./nfse.xml"
nf = NFSe()
nf.load_data(file_nfse)
print(type(nf.data))
pprint.pp(nf.data)

Output:

<class 'dict'>
{'nfse_id': 'NFS43149022227643216000121000000000008025091789495666',
 'local_emissao': 'Fortaleza',
 'local_prestacao': 'Fortaleza',
 'numero_nfse': '80',
 'codigo_local_incidencia': '6314902',
 'descricao_servico': 'Serviços de pesquisas de qualquer natureza',
 'valor_liquido': 3100.0,
 'data_processo': '2025-09-01T15:36:35-03:00',
 'Date': '2025-09-01',
 'Prestador': {'cnpj': '27543216700666',
               'nome': 'PRESTADOR LTDA',
               'endereco': {'logradouro': 'R DAS ACACIAS',
                            'numero': '1244',
                            'bairro': 'CIDADE ALTA',
                            'cidade': '4314902',
                            'uf': 'CE',
                            'cep': '90880480'},
               'telefone': '5132692269',
               'email': 'PRESTADOR@GMAIL.COM'},
 'Tomador': {'cnpj': '07704429000666',
             'nif': None,
             'nome': 'TOMADOR LTDA',
             'endereco': {'logradouro': 'AV BRASIL',
                          'numero': '666',
                          'complemento': 'SALA  666 E 666',
                          'bairro': 'CENTRO HISTORICO',
                          'cidade': '6314902',
                          'cep': '34020023'}},
 'servico': {'codigo_servico': '020101',
             'descricao_servico': 'Serviço de suporte técnico.',
             'valor_servico': 6666.0,
             'p_tributo_SN': 6.0},
 'ValorServico': 6666.0}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

babilonia-1.0.3.tar.gz (120.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

babilonia-1.0.3-py3-none-any.whl (57.2 kB view details)

Uploaded Python 3

File details

Details for the file babilonia-1.0.3.tar.gz.

File metadata

  • Download URL: babilonia-1.0.3.tar.gz
  • Upload date:
  • Size: 120.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for babilonia-1.0.3.tar.gz
Algorithm Hash digest
SHA256 1f5dbc753aaed84242d03ddab4261402986577f0981c8b01b70442606089423c
MD5 38626070bde75866d8679126b4148afe
BLAKE2b-256 bd044a939330e45941d23d6e047990679d3ac108b1a6dbcc8f9ac9a87c3aae0e

See more details on using hashes here.

File details

Details for the file babilonia-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: babilonia-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 57.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.14

File hashes

Hashes for babilonia-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 c6c3cf4c9237063e17394272ea0bf2e17928f64bf98337e6e6188d9a2cf7d984
MD5 423e59da14daf414dc7dcae71e29cfcc
BLAKE2b-256 c82cd905078d9821f671a29b781361b2acda1f4d2c97955c383b81ebddd6b75c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page