itables


Nameitables JSON
Version 2.0.0 PyPI version JSON
download
home_page
SummaryPandas and Polar DataFrames as interactive DataTables
upload_time2024-03-16 14:55:37
maintainer
docs_urlNone
author
requires_python>=3.7
license
keywords datatables interactive javascript pandas polars
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Interactive Tables

![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)
[![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)
[![Pypi](https://img.shields.io/pypi/v/itables.svg)](https://pypi.python.org/pypi/itables)
[![Conda Version](https://img.shields.io/conda/vn/conda-forge/itables.svg)](https://anaconda.org/conda-forge/itables)
[![pyversions](https://img.shields.io/pypi/pyversions/itables.svg)](https://pypi.python.org/pypi/itables)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

## Turn your Python DataFrames into Interactive DataTables

This packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.
With `itables` you can display your tables as interactive [DataTables](https://datatables.net/)
that 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.

The `itables` package only depends on `numpy`, `pandas` and `IPython`
which you must already have if you work with Pandas in Jupyter (add `polars`, `pyarrow` if you
work with Polars DataFrames).

## Documentation

Browse the [documentation](https://mwouts.github.io/itables/) to see
examples of Pandas or Polars DataFrames rendered as interactive DataTables.

## Quick start

Install the `itables` package with either
```shell
pip install itables
```

or
```shell
conda install itables -c conda-forge
```

Activate the interactive mode for all series and dataframes with
```python
from itables import init_notebook_mode

init_notebook_mode(all_interactive=True)
```
and then render any DataFrame as an interactive table that you can sort, search and explore:
![df](docs/df_example.png)

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](docs/show_df.png)

Since `itables==1.0.0`, the [jQuery](https://jquery.com/) and [DataTables](https://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)
- Quarto
- Shiny for Python

## Try ITables on Binder

You can run our examples notebooks directly on [![Lab](https://img.shields.io/badge/Binder-JupyterLab-blue.svg)](https://mybinder.org/v2/gh/mwouts/itables/main?urlpath=lab/tree/docs/quick_start.md), 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](docs/changelog.md)
and decide whether you should upgrade `itables`.

## <a name="downsampling"></a> 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](https://datatables.net/examples/data_sources/server_side). At a later stage we may implement support for larger tables using this feature.

```{code-cell}
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)
```

```{code-cell}
df
```

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

```{code-cell}
show(df, maxBytes=0)
```

or globally:

```{code-cell}
opt.maxBytes = 2 ** 20
df
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "itables",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "Marc Wouts <marc.wouts@gmail.com>",
    "keywords": "DataTables,Interactive,Javascript,Pandas,Polars",
    "author": "",
    "author_email": "Marc Wouts <marc.wouts@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/b1/be/e3a2596d45123f6e60551ee903ec3529c1af13146e28da71b27fc9f19e86/itables-2.0.0.tar.gz",
    "platform": null,
    "description": "# Interactive Tables\n\n![CI](https://github.com/mwouts/itables/actions/workflows/continuous-integration.yml/badge.svg?branch=main)\n[![codecov.io](https://codecov.io/github/mwouts/itables/coverage.svg?branch=main)](https://codecov.io/github/mwouts/itables?branch=main)\n[![Pypi](https://img.shields.io/pypi/v/itables.svg)](https://pypi.python.org/pypi/itables)\n[![Conda Version](https://img.shields.io/conda/vn/conda-forge/itables.svg)](https://anaconda.org/conda-forge/itables)\n[![pyversions](https://img.shields.io/pypi/pyversions/itables.svg)](https://pypi.python.org/pypi/itables)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n## Turn your Python DataFrames into Interactive DataTables\n\nThis packages changes how Pandas and Polars DataFrames are rendered in Jupyter Notebooks.\nWith `itables` you can display your tables as interactive [DataTables](https://datatables.net/)\nthat you can sort, paginate, scroll or filter.\n\nITables is just about how tables are displayed. You can turn it on and off in just two lines,\nwith no other impact on your data workflow.\n\nThe `itables` package only depends on `numpy`, `pandas` and `IPython`\nwhich you must already have if you work with Pandas in Jupyter (add `polars`, `pyarrow` if you\nwork with Polars DataFrames).\n\n## Documentation\n\nBrowse the [documentation](https://mwouts.github.io/itables/) to see\nexamples of Pandas or Polars DataFrames rendered as interactive DataTables.\n\n## Quick start\n\nInstall the `itables` package with either\n```shell\npip install itables\n```\n\nor\n```shell\nconda install itables -c conda-forge\n```\n\nActivate the interactive mode for all series and dataframes with\n```python\nfrom itables import init_notebook_mode\n\ninit_notebook_mode(all_interactive=True)\n```\nand then render any DataFrame as an interactive table that you can sort, search and explore:\n![df](docs/df_example.png)\n\nIf you prefer to render only selected DataFrames as interactive tables, use `itables.show` to show just one Series or DataFrame as an interactive table:\n![show](docs/show_df.png)\n\nSince `itables==1.0.0`, the [jQuery](https://jquery.com/) and [DataTables](https://datatables.net/) libraries and CSS\nare injected in the notebook when you execute `init_notebook_mode` with its default argument `connected=False`.\nThanks to this the interactive tables will work even without a connection to the internet.\n\nIf you prefer to load the libraries dynamically (and keep the notebook lighter), use `connected=True` when you\nexecute `init_notebook_mode`.\n\n## Supported environments\n\n`itables` has been tested in the following editors:\n- Jupyter Notebook\n- Jupyter Lab\n- Jupyter nbconvert (i.e. the tables are still interactive in the HTML export of a notebook)\n- Jupyter Book\n- Google Colab\n- VS Code (for both Jupyter Notebooks and Python scripts)\n- PyCharm (for Jupyter Notebooks)\n- Quarto\n- Shiny for Python\n\n## Try ITables on Binder\n\nYou can run our examples notebooks directly on [![Lab](https://img.shields.io/badge/Binder-JupyterLab-blue.svg)](https://mybinder.org/v2/gh/mwouts/itables/main?urlpath=lab/tree/docs/quick_start.md), without having to install anything on your side.\n\n## Table not loading?\n\nIf the table just says \"Loading...\", then maybe\n- You loaded a notebook that is not trusted (run \"Trust Notebook\" in View / Activate Command Palette)\n- You forgot to run `init_notebook_mode`, or you deleted that cell or its output\n- Or you ran `init_notebook_mode(connected=True)` but you are not connected to the internet?\n\nPlease note that if you change the value of the `connected` argument in\nthe `init_notebook_mode` cell, you will need to re-execute all the cells\nthat display interactive tables.\n\nIf the above does not help, please check out the [ChangeLog](docs/changelog.md)\nand decide whether you should upgrade `itables`.\n\n## <a name=\"downsampling\"></a> Downsampling\n\nWhen 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')`).\n\nNote that DataTables support [server-side processing](https://datatables.net/examples/data_sources/server_side). At a later stage we may implement support for larger tables using this feature.\n\n```{code-cell}\nfrom itables.sample_dfs import get_indicators\nfrom itables.downsample import nbytes\nimport itables.options as opt\n\nopt.lengthMenu = [2, 5, 10, 20, 50, 100, 200, 500]\nopt.maxBytes = 10000\n\ndf = get_indicators()\nnbytes(df)\n```\n\n```{code-cell}\ndf\n```\n\nTo show the table in full, we can modify the value of `maxBytes` either locally:\n\n```{code-cell}\nshow(df, maxBytes=0)\n```\n\nor globally:\n\n```{code-cell}\nopt.maxBytes = 2 ** 20\ndf\n```\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Pandas and Polar DataFrames as interactive DataTables",
    "version": "2.0.0",
    "project_urls": {
        "Changelog": "https://github.com/mwouts/itables/blob/main/docs/changelog.md",
        "Documentation": "https://mwouts.github.io/itables",
        "Homepage": "https://mwouts.github.io/itables/",
        "Issues": "https://github.com/mwouts/itables/issues",
        "Repository": "https://github.com/mwouts/itables.git"
    },
    "split_keywords": [
        "datatables",
        "interactive",
        "javascript",
        "pandas",
        "polars"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cd62700067da124ff0be27955df5b0bd2f7558189655b7c95061f2c8d54bd686",
                "md5": "061ef3336c58b94d16d03877d4aca1cc",
                "sha256": "34690c50ff16a450488aaf16a519f7f7203d1f165bee07694b1cf0bf76dc2594"
            },
            "downloads": -1,
            "filename": "itables-2.0.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "061ef3336c58b94d16d03877d4aca1cc",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 215561,
            "upload_time": "2024-03-16T14:55:35",
            "upload_time_iso_8601": "2024-03-16T14:55:35.354256Z",
            "url": "https://files.pythonhosted.org/packages/cd/62/700067da124ff0be27955df5b0bd2f7558189655b7c95061f2c8d54bd686/itables-2.0.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b1bee3a2596d45123f6e60551ee903ec3529c1af13146e28da71b27fc9f19e86",
                "md5": "17cfcdd56333ae405e9bcb8f4362c90a",
                "sha256": "858ac48e181a1168655e925a658b96d1ef77f5b7d499e0e73e7378aeabe38683"
            },
            "downloads": -1,
            "filename": "itables-2.0.0.tar.gz",
            "has_sig": false,
            "md5_digest": "17cfcdd56333ae405e9bcb8f4362c90a",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 1076937,
            "upload_time": "2024-03-16T14:55:37",
            "upload_time_iso_8601": "2024-03-16T14:55:37.035244Z",
            "url": "https://files.pythonhosted.org/packages/b1/be/e3a2596d45123f6e60551ee903ec3529c1af13146e28da71b27fc9f19e86/itables-2.0.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-16 14:55:37",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "mwouts",
    "github_project": "itables",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "itables"
}
        
Elapsed time: 0.20405s