Skip to content

Built-in datasets

plotjs has a few datasets that you can load easily:

  • iris
  • mtcars
  • titanic


plotjs.data.load_iris(output_format='pandas')

Load the iris dataset.

Parameters:

Name Type Description Default
output_format str

The output format of the dataframe. Note that, for example, if you set output_format="polars", you must have polars installed. Must be one of the following: "pandas", "polars", "pyarrow", "modin", "cudf". Default to "pandas".

'pandas'

Returns:

Type Description
Frame

The iris dataset.

Examples:

from plotjs import data

df = data.load_iris()
from plotjs import data

df = data.load_iris("polars")
from plotjs import data

df = data.load_iris("pyarrow")


plotjs.data.load_mtcars(output_format='pandas')

Load the mtcars dataset.

Parameters:

Name Type Description Default
output_format str

The output format of the dataframe. Note that, for example, if you set output_format="polars", you must have polars installed. Must be one of the following: "pandas", "polars", "pyarrow", "modin", "cudf". Default to "pandas".

'pandas'

Returns:

Type Description
Frame

The mtcars dataset.

Examples:

from plotjs import data

df = data.load_mtcars()
from plotjs import data

df = data.load_mtcars("polars")
from plotjs import data

df = data.load_mtcars("pyarrow")


plotjs.data.load_titanic(output_format='pandas')

Load the titanic dataset.

Parameters:

Name Type Description Default
output_format str

The output format of the dataframe. Note that, for example, if you set output_format="polars", you must have polars installed. Must be one of the following: "pandas", "polars", "pyarrow", "modin", "cudf". Default to "pandas".

'pandas'

Returns:

Type Description
Frame

The titanic dataset.

Examples:

from plotjs import data

df = data.load_titanic()
from plotjs import data

df = data.load_titanic("polars")
from plotjs import data

df = data.load_titanic("pyarrow")