Skip to main content

A pandas extension for rendering DataFrames

Project description

pandas-render

pandas-render

Render pandas or polars DataFrames and Series as HTML tables with flexibility for formatting and styling.

GitHub Repo stars Ko-fi

Installation

pip install "pandas-render[pandas]"
pip install "pandas-render[polars]"

Usage

This is a simple example that demonstrates the basic functionality. The column names are used to match individual Jinja2 templates. And {{ content }} is the placeholder for the content of the original cell.

from pandas_render import pandas as pd

df = pd.DataFrame(
    [
        dict(name="Alice", age=25, hobbies=["coding"]),
        dict(name="Bob", age=30, hobbies=["reading", "hiking"]),
    ]
)

df.render(
    templates=dict(
        name="<strong>{{ content }}</strong>",
        age="{{ content }} years old",
        hobbies="<em>{{ content|join(', ') }}</em>",
    ),
    table_column_names=["Name", "Age", "Hobbies"],
)

The result is a rendered dataframe:

NameAgeHobbies
Alice25 years oldcoding
Bob30 years oldreading, hiking

Examples

Exciting and more powerful features can be explored and learned in the Getting Started notebook.

List of all notebooks with examples:

Support

Do you like this project? Fuel it with a ☕ coffee on Ko-fi. Every little bit helps and means a lot!

Contributing

We encourage you to contribute to this project! Please check out the contributing guidelines about how to proceed.

License

This package is Open Source Software released under the BSD-3-Clause license.

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

pandas_render-0.4.0.tar.gz (160.6 kB view details)

Uploaded Source

Built Distribution

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

pandas_render-0.4.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file pandas_render-0.4.0.tar.gz.

File metadata

  • Download URL: pandas_render-0.4.0.tar.gz
  • Upload date:
  • Size: 160.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: python-httpx/0.28.1

File hashes

Hashes for pandas_render-0.4.0.tar.gz
Algorithm Hash digest
SHA256 e1d52ffe0524cdbd46b4821e78e0365fa2fd4de3bf6a7fa1f8c495133b30831e
MD5 1ad1e88360fc3ff2799784555225d055
BLAKE2b-256 e039f889aca496688ed5a7d1f33859ddb80cb301cc0dc590c84d2fe56115e976

See more details on using hashes here.

File details

Details for the file pandas_render-0.4.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pandas_render-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 73413636fa756f2d84af90978d4742145e5b724ff24cf342629f1e65a7f98be4
MD5 5c04a51ed4d27d5f2bac4e2a2ccd7c8f
BLAKE2b-256 6932466869587e81060f5d11f19c5b1152229c1bb0aef3832bca76b0ca398778

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