Configura automaticamente o AgGrid no Streamlit com base em um DataFrame
Project description
make-aggrid
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 (mas abaixo de 4.0) devido à dependência do streamlit-aggrid versão 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:
-
Faça um fork do repositório
-
Crie uma branch (git checkout -b nova-funcionalidade)
-
Faça suas alterações e commit (git commit -am 'Adiciona nova funcionalidade')
-
Push para a branch (git push origin nova-funcionalidade)
-
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file make_aggrid-0.1.8.tar.gz.
File metadata
- Download URL: make_aggrid-0.1.8.tar.gz
- Upload date:
- Size: 3.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.6 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
95452ae922c71ff67f815870aafe049c8e08acb55e467af81a9b99c94152cf2c
|
|
| MD5 |
f82cd589399b0e3518dc9480b5298382
|
|
| BLAKE2b-256 |
8922123ee9a126a5bfa17ed85bb91adce34458a811a1f9d6bbfd9d3ca6a01543
|
File details
Details for the file make_aggrid-0.1.8-py3-none-any.whl.
File metadata
- Download URL: make_aggrid-0.1.8-py3-none-any.whl
- Upload date:
- Size: 3.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/2.1.2 CPython/3.12.6 Windows/11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3b6c6f335e4ff5eae166c29da3364430e58dd029d8d2ed1aed01df191edd90cc
|
|
| MD5 |
8aac16d54c01b2c8707c931aafe1f47e
|
|
| BLAKE2b-256 |
0ea462ba747fdae7a6aa81bb438f9b6f6793ea1ec46b8aaf0331fb3081ef04cd
|