holoviz / holoviz/hvplot

Make it very clear that `hist` only support numerical or datetime fields

Open
#906 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
1.4k
Forks
124
Avg merge
1d 18h
Merged PRs (30d)
1

Description

hvplot=0.8.1, holoviews=1.15.0

I'm trying to show that it is much easier to use the HoloViz ecosystem to develop something like https://www.youtube.com/watch?v=htXgwEXwmNs with crossfiltering.

One of the plots is a plotly `histogram`.

It works like

```python
import plotly.express as px
df = px.data.tips()
px.histogram(df, "day", height=400,)
```

But if I run

```python
import plotly.express as px
import hvplot.pandas
df = px.data.tips()
df.hvplot.hist("day", height=400)
```

I get

```bash
numpy.core._exceptions._UFuncNoLoopError: ufunc 'multiply' did not contain a loop with signature matching types (dtype(' None
```

This is not a useful error message and took me quite some time to figure out what was wrong. Pandas `.plot` handles this much nicer.

```python
import plotly.express as px
df = px.data.tips()
df.hist("day", height=400)
```

```bash
ValueError: hist method requires numerical or datetime columns, nothing to plot.
```

**Please provide a similar useful error message and document it in the reference guide and docstring. Or even better support categorical data.**

Thanks.

## Additional Context

The next issue is that I should then probably do my own aggregations and use HoloViews `bars` which does not support linked selections. Hmmmm. Its not easy.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.