holoviews.element.tabular module#
- class holoviews.element.tabular.ItemTable(data, **params)[source]#
Bases:
Element
A tabular element type to allow convenient visualization of either a standard Python dictionary or a list of tuples (i.e. input suitable for an dict constructor). Tables store heterogeneous data with different labels.
Dimension objects are also accepted as keys, allowing dimensional information (e.g. type and units) to be associated per heading.
- Attributes:
- cols
- rows
Methods
cell_type
(row, col)Returns the cell type given a row and column index.
dimension_values
(dimension[, expanded, flat])Return the values along the requested dimension.
hist
(*args, **kwargs)Computes and adjoins histogram along specified dimension(s).
pprint_cell
(row, col)Get the formatted cell value for the given row and column indices.
reduce
([dimensions, function])Applies reduction along the specified dimension(s).
sample
([samples])Samples values at supplied coordinates.
Parameter Definitions
Parameters inherited from:
group = String(constant=True, default='ItemTable', label='Group')
A string describing the data wrapped by the object.
kdims = List(bounds=(0, 0), default=[], label='Kdims')
ItemTables hold an index Dimension for each value they contain, i.e. they are equivalent to the keys.
vdims = List(bounds=(0, None), default=[Dimension('Default')], label='Vdims')
ItemTables should have only index Dimensions.
- cell_type(row, col)[source]#
Returns the cell type given a row and column index. The common basic cell types are ‘data’ and ‘heading’.
- dimension_values(dimension, expanded=True, flat=True)[source]#
Return the values along the requested dimension.
- Parameters:
- dimension
str
The dimension to return values for.
- expandedbool,
optional
Whether to return the expanded values. Behavior depends on the type of data:
Columnar: If false, returns unique values
Geometry: If false, returns scalar values per geometry
Gridded: If false, returns 1D coordinates
- flatbool,
optional
Whether to flatten array.
- dimension
- Returns:
np.ndarray
Array of values along the requested dimension.
- hist(*args, **kwargs)[source]#
Computes and adjoins histogram along specified dimension(s).
Defaults to first value dimension if present otherwise falls back to first key dimension.
- reduce(dimensions=None, function=None, **reduce_map)[source]#
Applies reduction along the specified dimension(s).
Allows reducing the values along one or more key dimension with the supplied function. Supports two signatures:
Reducing with a list of dimensions, e.g.:
ds.reduce([‘x’], np.mean)
Defining a reduction using keywords, e.g.:
ds.reduce(x=np.mean)
- Parameters:
- dimensions
Dimension(s) to apply reduction on Defaults to all key dimensions
- function
Reduction operation to apply, e.g. numpy.mean
- spreadfn
Secondary reduction to compute value spread Useful for computing a confidence interval, spread, or standard deviation.
- **reductions
Keyword argument defining reduction Allows reduction to be defined as keyword pair of dimension and function
- Returns:
The
element
after
reductions
have
been
applied.
- sample(samples=None)[source]#
Samples values at supplied coordinates.
Allows sampling of element with a list of coordinates matching the key dimensions, returning a new object containing just the selected samples. Supports multiple signatures:
Sampling with a list of coordinates, e.g.:
ds.sample([(0, 0), (0.1, 0.2), …])
Sampling a range or grid of coordinates, e.g.:
1D : ds.sample(3) 2D : ds.sample((3, 3))
Sampling by keyword, e.g.:
ds.sample(x=0)
- Parameters:
- samples
List of nd-coordinates to sample
- bounds
Bounds of the region to sample Defined as two-tuple for 1D sampling and four-tuple for 2D sampling.
- closest
Whether to snap to closest coordinates
- **kwargs
Coordinates specified as keyword pairs Keywords of dimensions and scalar coordinates
- Returns:
Element
containing
the
sampled
coordinates
- class holoviews.element.tabular.Table(data=None, kdims=None, vdims=None, **kwargs)[source]#
Bases:
SelectionIndexExpr
,Dataset
,Tabular
Table is a Dataset type, which gets displayed in a tabular format and is convertible to most other Element types.
Parameter Definitions
Parameters inherited from:
holoviews.core.dimension.LabelledData
: labelholoviews.core.dimension.Dimensioned
: cdims, kdims, vdimsholoviews.core.data.Dataset
: datatypegroup = String(constant=True, default='Table', label='Group')
The group is used to describe the Table.