Package: itables
Interactive TablesTurn your Python DataFrames into Interactive TablesThis packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
Withitablesyou can display your tables as interactivedatatablesthat 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.Theitablespackage only depends onnumpy,pandasandIPythonwhich you must already have if you work with Pandas in Jupyter (addpolars,pyarrowif you
work with Polars DataFrames).DocumentationBrowse thedocumentationto see
examples of Pandas or Polars DataFrames rendered as interactive datatables.Quick startInstall theitablespackage with eitherpipinstallitablesorcondainstallitables-cconda-forgeActivate the interactive mode for all series and dataframes withfromitablesimportinit_notebook_modeinit_notebook_mode(all_interactive=True)and then render any DataFrame as an interactive table that you can sort, search and explore:If you prefer to render only selected DataFrames as interactive tables, useitables.showto show just one Series or DataFrame as an interactive table:Sinceitables==1.0.0, thejqueryanddatatables.netlibraries and CSS
are injected in the notebook when you executeinit_notebook_modewith its default argumentconnected=False.
Thanks to this the interactive tables will work even without a connection to the internet.If you prefer to load the libraries dynamically (and keep the notebook lighter), useconnected=Truewhen you
executeinit_notebook_mode.Supported environmentsitableshas been tested in the following editors:Jupyter NotebookJupyter LabJupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook)Jupyter BookGoogle ColabVS Code (for both Jupyter Notebooks and Python scripts)PyCharm (for Jupyter Notebooks)Try ITables on BinderYou can run our examples notebooks directly on, without having to install anything on your side.Table not loading?If the table just says "Loading...", then maybeYou loaded a notebook that is not trusted (run "Trust Notebook" in View / Activate Command Palette)You forgot to runinit_notebook_mode, or you deleted that cell or its outputOr you raninit_notebook_mode(connected=True)but you are not connected to the internet?Please note that if you change the value of theconnectedargument in
theinit_notebook_modecell, you will need to re-execute all the cells
that display interactive tables.If the above does not help, please check out theChangeLogand decide whether you should upgradeitables.DownsamplingWhen the data in a table is larger thanmaxBytes, which is equal to 64KB by default,itableswill display only a subset of the table - one that fits intomaxBytes. If you wish, you can deactivate the limit withmaxBytes=0, change the value ofmaxBytes, or similarly set a limit on the number of rows (maxRows, defaults to 0) or columns (maxColumns, defaults topd.get_option('display.max_columns')).Note that datatables supportserver-side processing. At a later stage we may implement support for larger tables using this feature.from itables.sample_dfs import get_indicators
from itables.downsample import nbytes
import itables.options as opt

opt.lengthMenu = [2, 5, 10, 20, 50, 100, 200, 500]
opt.maxBytes = 10000

df = get_indicators()
nbytes(df)dfTo show the table in full, we can modify the value ofmaxByteseither locally:show(df, maxBytes=0)or globally:opt.maxBytes = 2 ** 20
df