render.table

render.table(
    self,
    _fn=None,
    *,
    index=False,
    classes='table shiny-table w-auto',
    border=0,
    **kwargs,
)

Reactively render a pandas DataFrame object (or similar) as a basic HTML table.

Consider using data_frame instead of this renderer, as it provides high performance virtual scrolling, built-in filtering and sorting, and a better default appearance. This renderer may still be helpful if you use pandas styling features that are not currently supported by data_frame.

Parameters

index : bool = False

Whether to print index (row) labels. (Ignored for pandas Styler objects; call style.hide(axis="index") from user code instead.)

classes : str = 'table shiny-table w-auto'

CSS classes (space separated) to apply to the resulting table. By default, we use table shiny-table w-auto which is designed to look reasonable with Bootstrap 5. (Ignored for pandas Styler objects; call style.set_table_attributes('class="dataframe table shiny-table w-auto"') from user code instead.)

****kwargs** : object = {}

Additional keyword arguments passed to pandas.DataFrame.to_html() or pandas.io.formats.style.Styler.to_html().

Returns

:

A decorator for a function that returns any of the following: 1. A pandas DataFrame object. 2. A pandas Styler object. 3. Any object that has a .to_pandas() method (e.g., a Polars data frame or Arrow table).

Tip

The name of the decorated function (or @output(id=...)) should match the id of a output_table container (see output_table for example usage).

See Also

  • output_table for the corresponding UI component to this render function.

Examples

Loading...