ITables
ITables (Interactive Tables) is a Python package that transforms Pandas or Polars DataFrames into interactive DataTables, enhancing data exploration within Jupyter notebooks, VS Code, Google Colab, and various Python applications like Streamlit, Dash, and Shiny. It provides features such as sorting, pagination, scrolling, and filtering directly in the browser. The library is actively maintained, with frequent releases, and is currently at version 2.7.3.
Warnings
- gotcha Handling large datasets: By default, ITables downsamples large DataFrames to prevent performance issues (`maxBytes=64KB`). Setting `itables.options.maxBytes = 0` or a very large number can freeze your notebook or browser due to excessive data transfer to JavaScript.
- gotcha Offline vs. Online mode: `init_notebook_mode(connected=True)` loads DataTables libraries from a CDN, requiring internet. The default `connected=False` injects libraries for offline use. If you change the `connected` argument, you must re-execute all cells displaying interactive tables for the change to take effect.
- gotcha ITables provides read-only interaction. It allows for sorting, searching, and pagination, but you cannot edit or modify the underlying DataFrame data directly through the interactive table interface.
- deprecated Changes in core dependencies: Since v2.6.0, ITables has no direct package dependencies. Previously, `numpy`, `pandas`, and `IPython` were listed as dependencies. While not strictly 'breaking', users should be aware that these packages are still required for ITables to function with their respective DataFrame types and environments, but are now expected to be installed separately.
Install
-
pip install itables -
conda install -c conda-forge itables
Imports
- init_notebook_mode
from itables import init_notebook_mode
- show
from itables import show
- options
import itables.options as opt
Quickstart
import pandas as pd
import itables
# Activate interactive mode for all DataFrames
itables.init_notebook_mode(all_interactive=True)
# Create a sample DataFrame
data = {'col1': [1, 2, 3, 4, 5], 'col2': ['A', 'B', 'C', 'D', 'E']}
df = pd.DataFrame(data)
# Display the DataFrame (will be interactive automatically)
df