# 📦 bpandas
**bpandas** é uma coleção de helpers para deixar o uso do **pandas** mais simples e rápido.
Comece em segundos com **tabela de frequências** e **gráfico de barras + linha (dois eixos Y)** — limpo e profissional.
<p align="left">
<a href="https://pypi.org/project/bpandas/"><img alt="PyPI" src="https://img.shields.io/pypi/v/bpandas.svg"></a>
<img alt="Python" src="https://img.shields.io/badge/python-3.13-3776AB">
<a href="LICENSE"><img alt="License: MIT" src="https://img.shields.io/badge/License-MIT-green.svg"></a>
</p>
---
## ✨ O que vem pronto
- `bfrequencies(df, column, ...)` → distribuição de **frequências** (absoluta, relativa e acumuladas).
- `blinebar(df, x, y_bar, y_line, ...)` → **barras + linha** com **dois eixos Y** (matplotlib puro, layout clean).
> Ideal para dashboards rápidos, EDA e material didático.
---
## 📦 Instalação
PyPI:
```bash
pip install bpandas
Dev local (na raiz do projeto):
bash
Copiar
Editar
pip install -e .
Requisitos: Python 3.13. As versões das libs estão pinadas no pyproject.toml.
🚀 Comece em 30 segundos
python
Copiar
Editar
import pandas as pd
import bpandas as bp
# Exemplo simples
df = pd.DataFrame({"sexo": ["M","F","M","M","F", None]})
# 1) Tabela de frequências
freq = bp.bfrequencies(
df, "sexo",
include_na=True, # inclui ausentes
sort_by="index", # "index" ou "count"
ascending=True,
percent=True, # True = 0–100%; False = 0–1
decimals=2
)
print(freq.head())
# -> colunas: value, frequency, relative_frequency, cumulative_frequency, cumulative_relative_frequency
# 2) Gráfico: barras (freq absoluta) + linha (freq relativa acumulada)
bp.blinebar(
freq,
x="value",
y_bar="frequency",
y_line="cumulative_relative_frequency",
title="Distribuição por Sexo",
xlabel="Categorias",
ylabel_left="Frequência Absoluta",
ylabel_right="Frequência Acumulada (%)",
y2_is_percent=True, # formata eixo direito como %
rotate_xticks=0, # 0, 30, 45, 90...
# savepath="saida.png" # opcional: salva a figura
)
🧠 API (resumo)
bfrequencies(df, column_name, *, include_na=True, sort_by="index", ascending=True, percent=True, decimals=2) -> pd.DataFrame
Entrada: df (DataFrame), column_name (str).
Parâmetros úteis:
include_na (inclui/exclui ausentes) • sort_by ("index"/"count") • percent (0–100 vs 0–1) • decimals.
Saída: DataFrame com:
value, frequency, relative_frequency, cumulative_frequency, cumulative_relative_frequency.
blinebar(df, x, y_bar, y_line, *, title=None, xlabel=None, ylabel_left="Frequência Absoluta", ylabel_right="Frequência Acumulada (%)", y2_is_percent=True, figsize=(10,6), bar_width=0.65, color_bar=None, color_line=None, rotate_xticks=0, grid=True, savepath=None, show=True) -> (fig, ax, ax2)
Gráfico combinado (barras + linha) com 2 eixos Y.
y2_is_percent=True formata o eixo direito como % (assumindo 0–100).
Retorna fig, ax, ax2 para customizações posteriores.
🧪 Testes
bash
Copiar
Editar
python -m pytest -q
🛠 Roadmap
bsummary(df) — resumo rápido (shape, tipos, nulos, head).
bgroup(df, by, agg) — agrupamentos mais fáceis.
bexport(df, path) — salvar CSV/Excel/Parquet sem dor.
Sugestões são bem-vindas! Abra uma issue:
https://github.com/davidcloss/bpandas/issues
📄 Licença
MIT — veja LICENSE.
javascript
Copiar
Editar
se quiser, eu já crio um **CHANGELOG.md** básico (0.1.x) com as entradas de `bfrequencies`, `blinebar` e melhorias de README.
::contentReference[oaicite:0]{index=0}
Raw data
{
"_id": null,
"home_page": null,
"name": "bpandas",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.14,>=3.13",
"maintainer_email": null,
"keywords": "pandas, dataframe, frequencies, statistics, utility",
"author": "David Closs",
"author_email": "davidcloss@live.com",
"download_url": "https://files.pythonhosted.org/packages/9d/7d/514495111c3c32b4c488e13e3710a5191cddad0325421cee1e86de458540/bpandas-0.1.6.tar.gz",
"platform": null,
"description": "# \ud83d\udce6 bpandas\n\n**bpandas** \u00e9 uma cole\u00e7\u00e3o de helpers para deixar o uso do **pandas** mais simples e r\u00e1pido. \nComece em segundos com **tabela de frequ\u00eancias** e **gr\u00e1fico de barras + linha (dois eixos Y)** \u2014 limpo e profissional.\n\n<p align=\"left\">\n <a href=\"https://pypi.org/project/bpandas/\"><img alt=\"PyPI\" src=\"https://img.shields.io/pypi/v/bpandas.svg\"></a>\n <img alt=\"Python\" src=\"https://img.shields.io/badge/python-3.13-3776AB\">\n <a href=\"LICENSE\"><img alt=\"License: MIT\" src=\"https://img.shields.io/badge/License-MIT-green.svg\"></a>\n</p>\n\n---\n\n## \u2728 O que vem pronto\n\n- `bfrequencies(df, column, ...)` \u2192 distribui\u00e7\u00e3o de **frequ\u00eancias** (absoluta, relativa e acumuladas).\n- `blinebar(df, x, y_bar, y_line, ...)` \u2192 **barras + linha** com **dois eixos Y** (matplotlib puro, layout clean).\n\n> Ideal para dashboards r\u00e1pidos, EDA e material did\u00e1tico.\n\n---\n\n## \ud83d\udce6 Instala\u00e7\u00e3o\n\nPyPI:\n```bash\npip install bpandas\nDev local (na raiz do projeto):\n\nbash\nCopiar\nEditar\npip install -e .\nRequisitos: Python 3.13. As vers\u00f5es das libs est\u00e3o pinadas no pyproject.toml.\n\n\ud83d\ude80 Comece em 30 segundos\npython\nCopiar\nEditar\nimport pandas as pd\nimport bpandas as bp\n\n# Exemplo simples\ndf = pd.DataFrame({\"sexo\": [\"M\",\"F\",\"M\",\"M\",\"F\", None]})\n\n# 1) Tabela de frequ\u00eancias\nfreq = bp.bfrequencies(\n df, \"sexo\",\n include_na=True, # inclui ausentes\n sort_by=\"index\", # \"index\" ou \"count\"\n ascending=True,\n percent=True, # True = 0\u2013100%; False = 0\u20131\n decimals=2\n)\nprint(freq.head())\n# -> colunas: value, frequency, relative_frequency, cumulative_frequency, cumulative_relative_frequency\n\n# 2) Gr\u00e1fico: barras (freq absoluta) + linha (freq relativa acumulada)\nbp.blinebar(\n freq,\n x=\"value\",\n y_bar=\"frequency\",\n y_line=\"cumulative_relative_frequency\",\n title=\"Distribui\u00e7\u00e3o por Sexo\",\n xlabel=\"Categorias\",\n ylabel_left=\"Frequ\u00eancia Absoluta\",\n ylabel_right=\"Frequ\u00eancia Acumulada (%)\",\n y2_is_percent=True, # formata eixo direito como %\n rotate_xticks=0, # 0, 30, 45, 90...\n # savepath=\"saida.png\" # opcional: salva a figura\n)\n\ud83e\udde0 API (resumo)\nbfrequencies(df, column_name, *, include_na=True, sort_by=\"index\", ascending=True, percent=True, decimals=2) -> pd.DataFrame\nEntrada: df (DataFrame), column_name (str).\n\nPar\u00e2metros \u00fateis:\ninclude_na (inclui/exclui ausentes) \u2022 sort_by (\"index\"/\"count\") \u2022 percent (0\u2013100 vs 0\u20131) \u2022 decimals.\n\nSa\u00edda: DataFrame com:\nvalue, frequency, relative_frequency, cumulative_frequency, cumulative_relative_frequency.\n\nblinebar(df, x, y_bar, y_line, *, title=None, xlabel=None, ylabel_left=\"Frequ\u00eancia Absoluta\", ylabel_right=\"Frequ\u00eancia Acumulada (%)\", y2_is_percent=True, figsize=(10,6), bar_width=0.65, color_bar=None, color_line=None, rotate_xticks=0, grid=True, savepath=None, show=True) -> (fig, ax, ax2)\nGr\u00e1fico combinado (barras + linha) com 2 eixos Y.\n\ny2_is_percent=True formata o eixo direito como % (assumindo 0\u2013100).\n\nRetorna fig, ax, ax2 para customiza\u00e7\u00f5es posteriores.\n\n\ud83e\uddea Testes\nbash\nCopiar\nEditar\npython -m pytest -q\n\ud83d\udee0 Roadmap\nbsummary(df) \u2014 resumo r\u00e1pido (shape, tipos, nulos, head).\n\nbgroup(df, by, agg) \u2014 agrupamentos mais f\u00e1ceis.\n\nbexport(df, path) \u2014 salvar CSV/Excel/Parquet sem dor.\n\nSugest\u00f5es s\u00e3o bem-vindas! Abra uma issue:\nhttps://github.com/davidcloss/bpandas/issues\n\n\ud83d\udcc4 Licen\u00e7a\nMIT \u2014 veja LICENSE.\n\njavascript\nCopiar\nEditar\n\nse quiser, eu j\u00e1 crio um **CHANGELOG.md** b\u00e1sico (0.1.x) com as entradas de `bfrequencies`, `blinebar` e melhorias de README.\n::contentReference[oaicite:0]{index=0}\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "Fun\u00e7\u00f5es utilit\u00e1rias para facilitar o uso do pandas",
"version": "0.1.6",
"project_urls": {
"Homepage": "https://github.com/davidcloss/bpandas",
"Issues": "https://github.com/davidcloss/bpandas/issues",
"Repository": "https://github.com/davidcloss/bpandas"
},
"split_keywords": [
"pandas",
" dataframe",
" frequencies",
" statistics",
" utility"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "bf9aaf259f1ac9187c8eb3e7ce954c39e3b14ac18e0498a5ec0b7382b4772a95",
"md5": "3cfd20add4d896a8c7d08a610913f5a2",
"sha256": "e1999890363bafaba9c10b6ed064bf28b57b82d6e083b2dd76ea7432c8b9f520"
},
"downloads": -1,
"filename": "bpandas-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "3cfd20add4d896a8c7d08a610913f5a2",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.14,>=3.13",
"size": 6748,
"upload_time": "2025-08-21T16:47:23",
"upload_time_iso_8601": "2025-08-21T16:47:23.473855Z",
"url": "https://files.pythonhosted.org/packages/bf/9a/af259f1ac9187c8eb3e7ce954c39e3b14ac18e0498a5ec0b7382b4772a95/bpandas-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "9d7d514495111c3c32b4c488e13e3710a5191cddad0325421cee1e86de458540",
"md5": "f2251cd2e6c5fd63156b3a796e5c8800",
"sha256": "acfe2cab3dfee0755b1cda41979ef264490da4249a02d05795b2e5d1a0cb8556"
},
"downloads": -1,
"filename": "bpandas-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "f2251cd2e6c5fd63156b3a796e5c8800",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.14,>=3.13",
"size": 5804,
"upload_time": "2025-08-21T16:47:24",
"upload_time_iso_8601": "2025-08-21T16:47:24.378957Z",
"url": "https://files.pythonhosted.org/packages/9d/7d/514495111c3c32b4c488e13e3710a5191cddad0325421cee1e86de458540/bpandas-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-08-21 16:47:24",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "davidcloss",
"github_project": "bpandas",
"github_not_found": true,
"lcname": "bpandas"
}