cerburus

November 16, 2024 ยท View on GitHub

Print Polars DataFrames with hierarchical headers in plain text.

Usage

import cerburus
import polars as pl

df = pl.DataFrame({"a": [1, 2], "b": [3, 4], "c": [5, 6], "d": [7, 8]})
cerburus.pprint(
    df,
    headers=[
        ["1st title", "1st title", "2nd title", "2nd title"],
        ["1st subtitle", "2nd subtitle", "1st subtitle", "2nd subtitle"],
    ],
)

prints

         1st title                   2nd title
 1st subtitle 2nd subtitle   1st subtitle 2nd subtitle
            1            3              5            7
            2            4              6            8

One can also use cerbursus.to_string to get the result as a string instead of printing.

Installation

pip install cerbursus

Development state

This package is a proof-of-concept and in the early stage of development. It should not be relied on for production code.

Is something not working? Report an issue on our GitHub issue tracker!