Classes

Classes#

Select how your table looks like with the classes argument of the show function, or by changing itables.options.classes.

The default value for classes is "display nowrap compact" ("compact" was added in ITables v2.7).

Remove "compact" if you want a less dense table:

import pandas as pd

import itables

itables.init_notebook_mode()

df = itables.sample_dfs.get_countries()

itables.show(df, classes="display nowrap")
Loading ITables v2.7.0 from the init_notebook_mode cell... (need help?)

Remove "nowrap" if you want the cell content to be wrapped:

itables.show(
    pd.DataFrame({"text": ["This is a " + "very " * 60 + "long text"]}),
    classes="display compact",
)
Loading ITables v2.7.0 from the init_notebook_mode cell... (need help?)

More options like "cell-border" are available:

itables.show(df, classes="display nowrap compact cell-border")
Loading ITables v2.7.0 from the init_notebook_mode cell... (need help?)

Tip

You can change the default for all your notebooks and apps by creating an itables.toml configuration file in the current or a parent directory, with e.g. this content:

classes = ["display", "nowrap"]