Skip to main content

Interactive Tables in Jupyter

Project description

Interactive Tables

CI codecov.io Language grade: Python Pypi Conda Version pyversions Code style: black

Pandas DataFrames and Series as interactive datatables!

Documentation

Browse the documentation to see examples of Pandas datatables rendered as interactive datatables.

Quick start

Install the itables package with either

pip install itables

or

conda install itables -c conda-forge

Activate the interactive mode for all series and dataframes with

from itables import init_notebook_mode

init_notebook_mode(all_interactive=True)

and then render any Pandas DataFrame as an interactive table that you can sort, search and explore: df

If you prefer to render only selected DataFrames as interactive tables, use itables.show to show just one Series or DataFrame as an interactive table: show

Since itables==1.0.0, the jquery and datatables.net libraries and CSS are injected in the notebook when you execute init_notebook_mode with its default argument connected=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), use connected=True when you execute init_notebook_mode.

Supported environments

itables has been tested in the following editors:

  • Jupyter Notebook
  • Jupyter Lab
  • Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook)
  • Jupyter Book
  • Google Colab
  • VS Code (for both Jupyter Notebooks and Python scripts)
  • PyCharm (for Jupyter Notebooks)

Try ITables on Binder

You can run our examples notebooks directly on Lab, without having to install anything on your side.

Table not loading?

If the table just says "Loading...", then maybe

  • You loaded a notebook that is not trusted (run "Trust Notebook" in View / Activate Command Palette)
  • You forgot to run init_notebook_mode, or you deleted that cell or its output
  • Or you ran init_notebook_mode(connected=True) but you are not connected to the internet?

Please note that if you change the value of the connected argument in the init_notebook_mode cell, you will need to re-execute all the cells that display interactive tables.

If the above does not help, please check out the ChangeLog and decide whether you should upgrade itables.

Downsampling

When the data in a table is larger than maxBytes, which is equal to 64KB by default, itables will display only a subset of the table - one that fits into maxBytes. If you wish, you can deactivate the limit with maxBytes=0, change the value of maxBytes, or similarly set a limit on the number of rows (maxRows, defaults to 0) or columns (maxColumns, defaults to pd.get_option('display.max_columns')).

Note that datatables support server-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)
df

To show the table in full, we can modify the value of maxBytes either locally:

show(df, maxBytes=0)

or globally:

opt.maxBytes = 2 ** 20
df

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

itables-1.4.2.tar.gz (193.6 kB view details)

Uploaded Source

Built Distribution

itables-1.4.2-py3-none-any.whl (196.4 kB view details)

Uploaded Python 3

File details

Details for the file itables-1.4.2.tar.gz.

File metadata

  • Download URL: itables-1.4.2.tar.gz
  • Upload date:
  • Size: 193.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for itables-1.4.2.tar.gz
Algorithm Hash digest
SHA256 5e01cd1986b4f29f239c5e6d03e2ec912b956504dd96de7b7613a20794eaa6ad
MD5 f67324552ec3dc93236b8591775ff368
BLAKE2b-256 b454b26e5fae866971f3b4fe52b6452ccaac339b8045fa123181474b4fe85dcb

See more details on using hashes here.

File details

Details for the file itables-1.4.2-py3-none-any.whl.

File metadata

  • Download URL: itables-1.4.2-py3-none-any.whl
  • Upload date:
  • Size: 196.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.7.16

File hashes

Hashes for itables-1.4.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2c16a73cb33842f678255070e5a892d81cb37eecfeb52f218f33a3d21101d146
MD5 ee6358552bc94311964a0b9800c786ec
BLAKE2b-256 8642902de000ecbcb7ae31a4f17e7cf9104b0b7379c1bc3de74549059eceb96d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page