04 Working with Tabular Data ¶
As we have already discovered, HoloViews elements are simple wrappers around your data that provide a semantically meaningful representation. The real power of HoloViews becomes most evident when working with larger, multi-dimensional datasets, whether they are tabular like in a database or CSV file, or gridded like large datasets of images.
Tabular data (also called columnar data) is one of the most common, general, and versatile data formats, corresponding to how data is laid out in a spreadsheet. There are many different ways to put data into a tabular format, but for interactive analysis having tidy data provides flexibility and simplicity. Here we will show how to make your data tidy as a first step, but see hvPlot for convenient ways to work with non-tidy data directly.
In this tutorial all the information you have learned in the previous sections will finally really pay off. We will discover how to facet data and use different element types to explore and visualize the data contained in a real dataset, using many of the same libraries introduced earlier along with some statistics methods from SciPy:
import numpy as np import scipy.stats as ss import pandas as pd import holoviews as hv from holoviews import opts, dim, Palette hv.extension('bokeh') opts.defaults( opts.Bars(xrotation=45, tools=['hover']), opts.BoxWhisker(width=800, xrotation=30, box_fill_color=Palette('Category20')), opts.Curve(width=600, tools=['hover']), opts.GridSpace(shared_yaxis=True), opts.Scatter(width=800, height=400, color=Palette('Category20'), size=dim('growth')+5, tools=['hover']), opts.NdOverlay(legend_position='left'))