Here is the code:
import pandas as pd
import holoviews as hv
hv.extension('bokeh','matplotlib','plotly')
mydf = pd.DataFrame({
'x':np.arange(5),
'y':-np.arange(5),
'z':2+3*np.arange(5)
}
)
statdf = pd.DataFrame({'min':mydf.min(),
'max':mydf.max(),
'mean':mydf.mean()}).T
statdf
and in the next cell:
hv.Table(statdf)
Then you will get something like this:
Any help or clarification would be more that welcome!
Thanks!
1) You could set the index as your key dimension:
hv.Table(statdf, kdims=['index'])
When using the bokeh backend this will still give you the extra hv.Table() index. But this could also be an advantage, when you are sorting and want your dataframe back in the original order.
However, when you have the matplotlib or plotly backend hv.extension('plotly')
this solution will give you a dataframe with index.
2) Another option is to use a panel dataframe widget instead.
That will show the dataframe with the original index and still allows sorting etc.:
import panel as pn
pn.extension()
pn.widgets.DataFrame(statdf)
More info on pn.widgets.DataFrame():
https://panel.holoviz.org/reference/widgets/DataFrame.html#widgets-gallery-dataframe
Resulting dataframe using the panel widget: