Skip to main content

Jupyter Notebook extension to levarage pandas DataFrames by integrating DataTables JS.

Project description

Jupyter DataTables

Jupyter Notebook extension to levarage pandas DataFrames by integrating DataTables JS.


About

Data scientists and in fact many developers work with pd.DataFrame on daily basis to interpret data to process them. In my typical workflow. The common workflow is to display the dataframe, take a look at the data schema and then produce multiple plots to check the distribution of the data to have a clearer picture, perhaps search some data in the table, etc...

What if those distribution plots were part of the standard DataFrame and we had the ability to quickly search through the table with minimal effort? What if it was the default representation?

The jupyter-datatables uses jupyter-require to draw the table.


Installation

pip install jupyter-datatables

And enable the required extensions

jupyter nbextension install --sys-prefix --py jupyter_require
jupyter nbextension enable jupyter-require/extension

Usage

import numpy as np
import pandas as pd

from jupyter_datatables import init_datatables_mode

init_datatables_mode()

That's it, your default pandas representation will now use Jupyter DataTables!

df = pd.DataFrame(np.abs(np.random.randn(50, 5)), columns=list(string.ascii_uppercase[:5]))

Jupyter Datatables table representation


In most cases, you don't need to worry too much about the size of your data. Jupyter DataTables calculates required sample size based on a confidence interval (by default this would be 0.95) and margin of error and ceils it to the highest 'smart' value.

For example, for a data containing 100,000 samples, given 0.975 confidence interval and 0.02 margin of error, the Jupyter DataTables would calculate that 3044 samples are required and it would round it up to 4000.

Jupyter Datatables long table sample size

With additional note:

Sample size: 4,000 out of 100,000


We can also handle wide tables with ease.

df = pd.DataFrame(np.abs(np.random.randn(50, 20)), columns=list(string.ascii_uppercase[:20]))

Jupyter Datatables wide table representation


As per 0.3.0, there is a support for interactive tooltips:

Jupyter Datatables wide table representation

And also support for custom indices including Date type:

dft = pd.DataFrame({'A': np.random.rand(5),
                    'B': [1, 1, 3, 2, 1],
                    'C': 'This is a very long sentence that should automatically be trimmed',
                    'D': [pd.Timestamp('20010101'), pd.Timestamp('20010102'), pd.Timestamp('20010103'), pd.Timestamp('20010104'), pd.Timestamp('20010105')],
                    'E': pd.Series([1.0] * 5).astype('float32'),
                    'F': [False, True, False, False, True],
                   })

dft.D = dft.D.apply(pd.to_datetime)
dft.set_index('D', inplace=True)

Jupyter Datatables wide table representation



Current status and future plans:

Check out the Project Board where we track issues and TODOs for our Jupyter tooling!


Author: Marek Cermak macermak@redhat.com, @AICoE

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

jupyter-datatables-0.3.8.tar.gz (6.5 MB view details)

Uploaded Source

Built Distribution

jupyter_datatables-0.3.8-py2.py3-none-any.whl (21.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file jupyter-datatables-0.3.8.tar.gz.

File metadata

  • Download URL: jupyter-datatables-0.3.8.tar.gz
  • Upload date:
  • Size: 6.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for jupyter-datatables-0.3.8.tar.gz
Algorithm Hash digest
SHA256 f73149ea9f3a79dd8d8939c409ee4a680a09e769dbbd26ff48e8b92273751335
MD5 c78cc68371bc6ef69f44cf6bee32cb57
BLAKE2b-256 072f51f4e8da4bd52905c85c334ca079b7f6e17a6a50ec0e822fa9d9995567a8

See more details on using hashes here.

File details

Details for the file jupyter_datatables-0.3.8-py2.py3-none-any.whl.

File metadata

  • Download URL: jupyter_datatables-0.3.8-py2.py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.6.8

File hashes

Hashes for jupyter_datatables-0.3.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c0a0db91ddb7c355aa21984775c73cecdfc1be5b2c59613fe7369e2f1f17dd8b
MD5 edf9daf559de460acfb36dbd16dd8033
BLAKE2b-256 08a4078ab43ab7d3d11ed0b01a83a05d13ce9f295630c3d892fd47d2823fed9b

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