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
Report Formats
HTML
Text
┌──────────┬──────────┬──────────────┐
│ Name │ DOB │ City │
├──────────┼──────────┼──────────────┤
│ Barkley │ 19630220 │ Philadelphia │
├──────────┼──────────┼──────────────┤
│ Pippen │ 19650925 │ Chicago │
├──────────┼──────────┼──────────────┤
│ Robinson │ 19650806 │ San Antonio │
└──────────┴──────────┴──────────────┘
JSON
[
{
"Name":"Barkley",
"DOB":"19630220",
"City":"Philadelphia"
},
{
"Name":"Pippen",
"DOB":"19650925",
"City":"Chicago"
},
{
"Name":"Robinson",
"DOB":"19650806",
"City":"San Antonio"
}
]
YAML
- City: Philadelphia
DOB: '19630220'
Name: Barkley
- City: Chicago
DOB: '19650925'
Name: Pippen
- City: San Antonio
DOB: '19650806'
Name: Robinson
Colophon
Build reports:
Metadata
Release files for pandasreporter 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pandasreporter-1.1.1.tar.gz | 8.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pandasreporter-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.8 kB
Release files / pandasreporter-1.1.1.tar.gz
| Download URL | pandasreporter-1.1.1.tar.gz |
|---|---|
| Size | 8.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
939585688ef2d48452984b0d208cbf67d5e3148fc2eb292121c6aafa81a11f9c
|
|
BLAKE2b-256 checksum How to use checksums |
ac9f8f7fd1e91a06d849e75865ed7a2bec52ade0c3da4ec7fa4aebd6c3b16b16
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.14.6 Linux/6.17.0-1018-azure
|
Release files / pandasreporter-1.1.1-py3-none-any.whl
| Download URL | pandasreporter-1.1.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0bbafe4e3d1160f3f51ce4192e5a7aaf7468a7304e094e2414357a66ffaf413f
|
|
BLAKE2b-256 checksum How to use checksums |
d7c6de88d596ef36b145c8800ba285c819c97b2eb49a9157b02c296544c797cf
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.3.2 CPython/3.14.6 Linux/6.17.0-1018-azure
|
Security for pandasreporter 1.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.