Skip to content

Repository files navigation

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.

About

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

Topics

Resources

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages