ITables in Quarto

Interactive Tables in HTML presentations

How to use ITables in Quarto

Activate ITables (same as in Jupyter, VS Code, PyCharm, Google Colab…)

from itables import init_notebook_mode

init_notebook_mode(all_interactive=True)
This is the init_notebook_mode cell from ITables v2.0.1
(you should not see this message - is your notebook trusted?)
… and all DataFrames become interactive!
from itables.sample_dfs import get_countries

get_countries(html=False)
region country capital longitude latitude
code
Loading ITables v2.0.1 from the init_notebook_mode cell... (need help?)

How to make my table fit in one slide?

How to make your table smaller

  • display only a few rows with lengthMenu,
  • adjust the style or font with a custom css

This document uses

from IPython.display import display, HTML
import itables.options as opt


# show 5 rows per 'page'
opt.lengthMenu = [5]

# don't show the length control
opt.layout["topStart"] = None

# use a smaller font (default is medium)
# see https://developer.mozilla.org/en-US/docs/Web/CSS/font-size
display(HTML("<style>.dt-container { font-size: medium; }</style>"))

Advanced Parameters

Parameters

ITables’ advanced parameters:

  • Can be set globally on opt, or
  • Passed as arguments to the show function.
  • Table-specific arguments like caption are only available in show.

Global Options and Quarto’s cache

Quarto uses a cache that may prevent your changes on itables.options to become effective when you run quarto render.

In that case, use --cache-refresh or even --execute-daemon-restart.

About ITables

GitHub Star

ITables is developed by Marc Wouts on GitHub, under a MIT license.

Under the hood

ITables renders Pandas or Polars DataFrames as interactive HTML tables using the JavaScript DataTables library.

Documentation

Learn More about ITables in the documentation.