Skip to main content

Interactive Tables in Jupyter

Project description

Interactive Tables

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

Pandas DataFrames and Series as interactive datatables!

Install the package with

pip install itables

Activate the interactive mode for all series and dataframes with

from itables import init_notebook_mode

init_notebook_mode(all_interactive=True)

or use itables.show to show just one Series or DataFrame as an interactive table.

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.

Documentation

Read more about itables and advanced use cases in the documentation.

In particular, the show method let you pass custom parameters to datatables.net's DataTable()'s constructor - see the advanced parameters examples.

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
import itables.options as opt

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

df = get_indicators()
df.values.nbytes
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


Release history Release notifications | RSS feed

This version

1.1.2

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.1.2.tar.gz (190.5 kB view details)

Uploaded Source

Built Distribution

itables-1.1.2-py3-none-any.whl (193.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: itables-1.1.2.tar.gz
  • Upload date:
  • Size: 190.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for itables-1.1.2.tar.gz
Algorithm Hash digest
SHA256 50fad0ee20b8be62c3dbb8870cf2be83dd8a4fc1265fd63e8fb7f41bcb6b3c83
MD5 fcef2f1b2cf185d5795cc7645521d3f5
BLAKE2b-256 322e5d29780c39d0a6c675c603f672a594a34d3f09c49a305b63c464441c86e7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: itables-1.1.2-py3-none-any.whl
  • Upload date:
  • Size: 193.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.7.13

File hashes

Hashes for itables-1.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5be5c414816e909dd22e42ecf0da9e79b82e77f70d4277344af890db9386d0f0
MD5 b34b12dd922876e535ea392c29a3c7d0
BLAKE2b-256 513354229f67a1a2bb3c0f170d7613c02dbcfe855200111bfb6a5a8df6b6ac52

See more details on using hashes here.

Supported by

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