Skip to main content

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


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.1.5.tar.gz (45.1 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.1.5-py3-none-any.whl (50.8 kB view details)

Uploaded Python 3

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

Hashes for flatbread-0.1.5.tar.gz
Algorithm Hash digest
SHA256 df979dcf68d0355ff83c2902909216f1e6ce7c18fccbbb5ec568a75462a539b7
MD5 8bee2348e96736c78b9835af41281986
BLAKE2b-256 42f0f155429bd287ff006d815577bf460fa8df795b2524275b5d8944d3d6ed87

See more details on using hashes here.

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

Hashes for flatbread-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 c06eba99fba524815a1f41b07c6a07525ec89c6b1a66f2cdbf9fdb44d07ac926
MD5 9161ad77d91f2f50958e8e7a1180b578
BLAKE2b-256 37ab6acf7a5947704de1b143acb84b0c47a3547a057171893839b03482300c89

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