enable_tbl_preview()

Register tbl_preview() as the default DataFrame display formatter.

Usage

Source

enable_tbl_preview(**kwargs)

After calling this, any Polars or Pandas DataFrame that is the last expression in a cell (or passed to display()) will be rendered as a tbl_preview() table instead of the library’s default HTML.

Parameters

**kwargs: Any
Keyword arguments forwarded to tbl_preview() (e.g., n_head=10, show_all=True, show_dimensions=False).

Returns

None
The formatter is registered as a side effect. IPython suppresses None output, so nothing is printed in the cell.

Examples

import pandas as pd
import great_docs as gd

df = pd.DataFrame({"name": ["Alice", "Bob", "Carol"], "score": [92, 87, 95]})

Before enabling, the DataFrame renders with default Pandas HTML:

df
name score
0 Alice 92
1 Bob 87
2 Carol 95

After enabling, the same DataFrame renders as a tbl_preview() table:

gd.enable_tbl_preview(n_head=3)
df
PandasRows3Columns2
name
str
score
i64
0 Alice 92
1 Bob 87
2 Carol 95

From this point on, all DataFrames (Pandas, Polars, or otherwise) will render using tbl_preview() until disable_tbl_preview() is called.

See Also