Skip to main content

Report builder for Pandas DataFrame

Project description

Avatar

Build Status Dependencies Status Code Scanning Status Security Status Published Version

Pandas Reporter

Pandas Reporter is a report builder for Pandas DataFrame. It generates HTML, JSON, text, or YAML report containing the data in the data frame.

Installation

pip3 install pandasreporter

Usage

Create pandasreporter object and run it:

from pandasreporter import PandasReporter

# Prepare your data frame
data = {
    "Name": ["Barkley", "Pippen", "Robinson"],
    "DOB": ["19630220", "19650925", "19650806"],
    "City": ["Philadelphia", "Chicago", "San Antonio"],
}
data_frame = pd.DataFrame(data)

pandas_reporter = PandasReporter()
_opts = {
    "title": "Pandas Report",
    "generator": "Pandas Reporter",
    "rows_styler": <rows_styler_function>,
    "max_col_size": 80,
}

pandas_reporter.report(
    data_frame,
    "html", # other formatters: json, text, or yaml
    _opts,
)

Configuration

These are the optional properties that you can use with pandasreporter.report. Some example report files are available on examples folder.

Opt Type Description Example Formatter
max_col_size Number Maximum value length 80 All
title String HTML report title value Pandas Report html
generator String HTML report generator meta Pandas Reporter html
rows_styler Function Data row styler html

HTML Rows Styler

Rows styler can be used to apply style to each of the table rows in HTML report.

Here's an example rows styler function which checks a row's "Expiry Date" column value against current date and a threshold date, and add background-color style accordingly:

def rows_styler(row):
    today = pd.Timestamp.today()
    threshold_date = today + pd.DateOffset(days=self.expiry_threshold_in_days)
    if row["Expiry Date"] <= today:
        style = ["background-color: LightPink"] * len(row)
    elif row["Expiry Date"] <= threshold_date:
        style = ["background-color: LightYellow"] * len(row)
    else:
        style = ["background-color: LightGreen"] * len(row)
    return style

Colophon

Developer's Guide

Build reports:

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

pandasreporter-0.10.0.tar.gz (7.6 kB view details)

Uploaded Source

Built Distribution

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

pandasreporter-0.10.0-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file pandasreporter-0.10.0.tar.gz.

File metadata

  • Download URL: pandasreporter-0.10.0.tar.gz
  • Upload date:
  • Size: 7.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for pandasreporter-0.10.0.tar.gz
Algorithm Hash digest
SHA256 be44fbe299dd6e0c5425e839ebefde62fb5c138d3b545634844a578b4e39b8f2
MD5 ceb638375aa57857561f8c2c77523a9f
BLAKE2b-256 acafb7517906f88d7e0fc876d4ee94cf6261bd9bce24b27b9a5a2554f2c3ce75

See more details on using hashes here.

File details

Details for the file pandasreporter-0.10.0-py3-none-any.whl.

File metadata

  • Download URL: pandasreporter-0.10.0-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.2.1 CPython/3.12.12 Linux/6.11.0-1018-azure

File hashes

Hashes for pandasreporter-0.10.0-py3-none-any.whl
Algorithm Hash digest
SHA256 adce60643e852eb3953f7f6c8ef5951c7b354babe72667ac10a9fd0c887f680a
MD5 e10738ced6fa18aa5043b1010a7cc8cc
BLAKE2b-256 64eabf1fd1db3f7138d6aa6e40a60cd22c3f0d20a7793dc84b73955f7d411f69

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