Skip to main content

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

Download files

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

Source Distribution

flatbread-0.2.0.tar.gz (160.5 kB view details)

Uploaded Source

Built Distribution

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

flatbread-0.2.0-py3-none-any.whl (67.0 kB view details)

Uploaded Python 3

File details

Details for the file flatbread-0.2.0.tar.gz.

File metadata

  • Download URL: flatbread-0.2.0.tar.gz
  • Upload date:
  • Size: 160.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for flatbread-0.2.0.tar.gz
Algorithm Hash digest
SHA256 cfaec7f2d29460288d24bc16fb4a687934d716d2267bc2345b4bea10d7193939
MD5 b4fa429242911800f89990f6f3e93c4f
BLAKE2b-256 a67094755c083484ebc5c0b0b7ba294f76b6e5e64f77dc547741896ad1539cea

See more details on using hashes here.

File details

Details for the file flatbread-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: flatbread-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 67.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for flatbread-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8eb971dc8973e1d359b27a0f5415fac5c7d77efda8dddfdd0a60a5b6fe27e8c5
MD5 4dc3fe6dfbd49fdf4e0b36ff2d94efa6
BLAKE2b-256 9e6d9443dbaa0dbb9e50fb473e225b947948c4cb77645272e9601ed7ecef0711

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 Sentry Error logging StatusPage Status page