ITables Logo

CI codecov.io MIT License Pypi Conda Version pyversions Code style: black Jupyter Widget Streamlit App

This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks. With itables you can display your tables as interactive DataTables that you can sort, paginate, scroll or filter.

ITables is just about how tables are displayed. You can turn it on and off in just two lines, with no other impact on your data workflow.

The itables package depends only on numpy, pandas and IPython which you must already have if you work with Pandas in Jupyter (add polars, pyarrow if you work with Polars DataFrames).

Quick Start#

Installation#

Install the itables package with either

pip install itables

or

conda install itables -c conda-forge

Activate ITables in a Notebook#

Activate the interactive mode in notebook-like environment with init_notebook_mode:

from itables import init_notebook_mode

init_notebook_mode(all_interactive=True)

After this, any Pandas or Polars DataFrame, or Series, is displayed as an interactive DataTables, which lets you explore, filter or sort your data.

from itables.sample_dfs import get_countries

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

If you prefer to render only certain tables using itables, or want to pass advanced parameters along with the DataFrame, use show:

from itables import show

show(df, lengthMenu=[2, 5, 10, 25, 50, 100, 250])
region country capital longitude latitude
code
Loading ITables v2.2.4 from the init_notebook_mode cell... (need help?)

Offline mode versus connected mode#

ITables use two Javascript libraries: jQuery and DataTables.

By default itables works offline. No internet connection is required as the two libraries are embedded into the notebook itself when you execute init_notebook_mode.

In some contexts (Jupyter Book, Jupyter Colab, etc…) you might prefer to load the libraries dynamically from the internet. To do so, add the argument connected=True when you execute init_notebook_mode. This will also make your notebook lighter by about 700kB.

Try ITables on Binder#

You can run the examples above (or any other documentation page) directly on Lab, without having to install anything on your end - just click on the rocket icon at the top of the page.