Pandas extension for aggregation and tabular display
Project description
Flatbread
Flatbread is a Python library that extends pandas with tabulation features. It makes it easy to create and display summary tables with totals, subtotals, percentages, and aggregations.
Flatbread can be accessed in DataFrames and Series using the pita accessor.
It uses the wc-simple-table dataviewer web component to display tables in a notebook: check out some examples.
Key Features
- Add row and column totals/subtotals to DataFrames and Series
- Calculate and format percentages with proper rounding
- Preserve data types and index structures
- Table display in Jupyter notebooks
Quick Example
import pandas as pd
import flatbread
df = pd.DataFrame(...)
# Add totals and percentages
result = (
df
.pita.add_totals() # Add grand totals
.pita.add_subtotals(level=0) # Add subtotals by first index level
.pita.add_percentages() # Add percentage columns
)
# Display with interactive viewer
result.pita.configure_display(
locale="en-US",
show_hover=True,
section_levels=1
)
Installation
pip install flatbread
Main Features
- Totals: Add row/column totals with
add_totals() - Subtotals: Add subtotals by index level with
add_subtotals() - Percentages: Add percentage calculations with
add_percentages() - Aggregation: Custom aggregations with
add_agg() - Display: Table viewer with rich formatting options
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 flatbread-0.1.5.tar.gz.
File metadata
- Download URL: flatbread-0.1.5.tar.gz
- Upload date:
- Size: 45.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
df979dcf68d0355ff83c2902909216f1e6ce7c18fccbbb5ec568a75462a539b7
|
|
| MD5 |
8bee2348e96736c78b9835af41281986
|
|
| BLAKE2b-256 |
42f0f155429bd287ff006d815577bf460fa8df795b2524275b5d8944d3d6ed87
|
File details
Details for the file flatbread-0.1.5-py3-none-any.whl.
File metadata
- Download URL: flatbread-0.1.5-py3-none-any.whl
- Upload date:
- Size: 50.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c06eba99fba524815a1f41b07c6a07525ec89c6b1a66f2cdbf9fdb44d07ac926
|
|
| MD5 |
9161ad77d91f2f50958e8e7a1180b578
|
|
| BLAKE2b-256 |
37ab6acf7a5947704de1b143acb84b0c47a3547a057171893839b03482300c89
|