Skip to content

Add a sampledata module to mirror hvsampledata's API? #1496

@maximlt

Description

@maximlt

hvsampledata has just been created and I would like to discuss whether we should integrate it further in hvPlot. This new package offers a simple API to load a dataset. Here penguins is a function that takes an optional engine (e.g. 'polars'), optional engine kwargs, and an optional lazy keyword.

from hvsampledata import penguins
df = penguins()

We can already use it to improve our examples:

```python
import hvplot.pandas
from hvsampledata import penguins

df = penguins()
df.hvplot()

I wonder whether we should add a sampledata top-level module that basically mirrors hvsampledata's API (i.e. from hvsampledata import penguins, ...) to make it even more accessible:

import hvplot.pandas

df = hvplot.sampledata.penguins()
df.hvplot()

As a developer, I quite like the idea that I could display a plot in 2 lines:

import hvplot.pandas
hvplot.sampledata.penguins().hvplot()

or

import hvplot.polars
hvplot.sampledata.penguins('polars', lazy=True).hvplot()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions