Skip to main content

Configura automaticamente o AgGrid no Streamlit com base em um DataFrame

Project description

make-aggrid

PyPI version Python versions License: MIT GitHub Repo stars

make-aggrid é uma biblioteca Python que facilita a configuração avançada do componente AgGrid para uso com Streamlit. Basta passar um DataFrame e ela automaticamente aplica filtros, formatações e estilos adequados com base nos tipos de dados.

📦 Instalação

Com pip

pip install make-aggrid streamlit-aggrid==1.1.2

com poetry

poetry add make-aggrid streamlit-aggrid@1.1.2

⚠️ O make-aggrid requer Python 3.10 ou superior por depender do streamlit-aggrid =1.1.2.

Uso Básico

import pandas as pd
import streamlit as st
from st_aggrid import AgGrid
from make_aggrid import make_grid

df = pd.read_csv("dados.csv")

grid_options = make_grid(df)

grid_response = AgGrid(
    st.session_state.df,
    gridOptions=grid_options,
    enable_enterprise_modules=False,
    fit_columns_on_grid_load=True,
    allow_unsafe_jscode=True,
    height=400
)

🎯 Recursos incluídos

  • Filtros automáticos para texto, número e datas
  • Formatação brasileira para números e datas (pt-BR)
  • Alinhamento de colunas conforme tipo
  • Edição inline
  • Paginação e animações

🧪 Exemplo Avançado com Streamlit

import streamlit as st
import pandas as pd
from st_aggrid import AgGrid
from make_aggrid import make_grid

data = {
    "Nome": ["Ana", "João", "Carlos"],
    "Idade": [23, 35, 29],
    "Salário": [3000.50, 5000.00, 4200.75],
    "Data de Admissão": pd.to_datetime(["2020-01-15", "2019-03-10", "2021-07-22"])
}

df = pd.DataFrame(data)

st.title("Tabela Interativa com AgGrid")

grid_options = make_grid(df)
AgGrid(df, gridOptions=grid_options, editable=True, fit_columns_on_grid_load=True)

🤝 Contribuir

Contribuições são muito bem-vindas! Para contribuir:

  1. Faça um fork do repositório

  2. Crie uma branch (git checkout -b nova-funcionalidade)

  3. Faça suas alterações e commit (git commit -am 'Adiciona nova funcionalidade')

  4. Push para a branch (git push origin nova-funcionalidade)

  5. Abra um Pull Request

Sinta-se à vontade para abrir issues com ideias, sugestões ou bugs que encontrar.

📝 Changelog

Todas as mudanças relevantes são listadas no CHANGELOG.md

Licença

MIT

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

make_aggrid-0.1.7.tar.gz (3.5 kB view details)

Uploaded Source

Built Distribution

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

make_aggrid-0.1.7-py3-none-any.whl (3.8 kB view details)

Uploaded Python 3

File details

Details for the file make_aggrid-0.1.7.tar.gz.

File metadata

  • Download URL: make_aggrid-0.1.7.tar.gz
  • Upload date:
  • Size: 3.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.6 Windows/11

File hashes

Hashes for make_aggrid-0.1.7.tar.gz
Algorithm Hash digest
SHA256 b9ea69f14a757103f4d67c5f889d58d39263f46d01d562053d86466f18953b77
MD5 bce44f6b209339bb6797da0c2a9de540
BLAKE2b-256 82cd786ca445370835a1121fc015f1327ebd4872c7496f6fa5a710ac7be39d91

See more details on using hashes here.

File details

Details for the file make_aggrid-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: make_aggrid-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 3.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.0.0 CPython/3.12.6 Windows/11

File hashes

Hashes for make_aggrid-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 52cbae52863f9d98f66119d0c1f8757d2d25e68467ea6a865f05e24986d18755
MD5 45c6ecec7ac07253b52db473c1d1714b
BLAKE2b-256 f023dc6051af89dc9145f89991cceb82d5ec84a74b18575d07d79e46d4684e01

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