Make it possible to create hist plots of time data
- Dominant language
- Python
- Stars
- 1.4k
- Forks
- 124
- Avg merge
- 1d 18h
- Merged PRs (30d)
- 1
Description
Motivated by #998 I'm trying to improve the `hist` reference guide. As its not very clear which types of data is supported I'm trying to add an example of creating a `hist` plot from time data. But this seems not possible.
Please support this
```python
import pandas as pd
from bokeh.sampledata.commits import data
data=data.reset_index().sort_values("datetime")
data["time"] = pd.to_datetime(data['time'],format= '%H:%M:%S' ).dt.time
data.hvplot.hist("time")
```
```bash
Traceback (most recent call last):
File "C:\repos\private\hvplot\.venv\lib\site-packages\IPython\core\interactiveshell.py", line 3433, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
File "C:\Users\masma\AppData\Local\Temp\ipykernel_40112\2449246375.py", line 1, in
data.hvplot.hist("time")
File "c:\repos\private\hvplot\hvplot\plotting\core.py", line 1324, in hist
return self(kind="hist", x=None, y=y, by=by, **kwds)
File "c:\repos\private\hvplot\hvplot\plotting\core.py", line 92, in __call__
return self._get_converter(x, y, kind, **kwds)(kind, x, y)
File "c:\repos\private\hvplot\hvplot\converter.py", line 1240, in __call__
obj = method(x, y)
File "c:\repos\private\hvplot\hvplot\converter.py", line 1820, in hist
hists = histogram(ds, dimension=y, **hist_opts)
File "C:\repos\private\hvplot\.venv\lib\site-packages\param\parameterized.py", line 3654, in __new__
return inst.__call__(*args,**params)
File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 220, in __call__
return element.apply(self, **kwargs)
File "c:\repos\private\tmp\holoviews\holoviews\core\accessors.py", line 45, in pipelined_call
result = __call__(*args, **kwargs)
File "c:\repos\private\tmp\holoviews\holoviews\core\accessors.py", line 202, in __call__
new_obj = apply_function(self._obj, **inner_kwargs)
File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 214, in __call__
return self._apply(element)
File "c:\repos\private\tmp\holoviews\holoviews\core\operation.py", line 141, in _apply
ret = self._process(element, key)
File "c:\repos\private\tmp\holoviews\holoviews\operation\element.py", line 726, in _process
data = data.astype('datetime64[ns]').astype('int64')
ValueError: Could not convert object to NumPy datetime
```
Contributor guide
Assessment
This issue has not been assessed yet.