holoviews.core.data.multipath module#

class holoviews.core.data.multipath.MultiInterface(*, name)[source]#

Bases: Interface

MultiInterface allows wrapping around a list of tabular datasets including dataframes, the columnar dictionary format or 2D tabular NumPy arrays. Using the split method the list of tabular data can be split into individual datasets.

The interface makes the data appear a list of tabular datasets as a single dataset. The interface may be used to represent geometries so the behavior depends on the type of geometry being represented.

Methods

add_dimension(dataset, dimension, dim_pos, ...)

Returns a copy of the data with the dimension values added.

assign(dataset, new_data)

Adds a dictionary containing data for multiple new dimensions to a copy of the dataset.data.

dtype(dataset, dimension)

Returns the dtype for the selected dimension.

has_holes(dataset)

Whether the Dataset contains geometries with holes.

holes(dataset)

Returns a list of lists of arrays containing the holes for each geometry in the Dataset.

iloc(dataset, index)

Implements integer indexing on the rows and columns of the data.

isscalar(dataset, dim[, per_geom])

Tests if dimension is scalar in each subpath.

length(dataset)

Returns the length of the multi-tabular dataset making it appear like a single array of concatenated subpaths separated by NaN values.

nonzero(dataset)

Returns a boolean indicating whether the Dataset contains any data.

range(dataset, dim)

Computes the minimum and maximum value along a dimension.

redim(dataset, dimensions)

Renames dimensions in the data.

reindex(dataset[, kdims, vdims])

Reindexes data given new key and value dimensions.

select(dataset[, selection_mask])

Applies selectiong on all the subpaths.

select_paths(dataset, index)

Allows selecting paths with usual NumPy slicing index.

shape(dataset)

Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.

split(dataset, start, end, datatype, **kwargs)

Splits a multi-interface Dataset into regular Datasets using regular tabular interfaces.

validate(dataset[, vdims])

Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.

values(dataset, dimension[, expanded, flat, ...])

Returns a single concatenated array of all subpaths separated by NaN values.

aggregate

dimension_type

geom_type

groupby

init

sample

sort

Parameter Definitions


classmethod add_dimension(dataset, dimension, dim_pos, values, vdim)[source]#

Returns a copy of the data with the dimension values added.

Parameters:
datasetDataset

The Dataset to add the dimension to

dimensionDimension

The dimension to add

dim_posint

The position in the data to add it to

valuesarray_like

The array of values to add

vdimbool

Whether the data is a value dimension

Returns:
data

A copy of the data with the new dimension

classmethod assign(dataset, new_data)[source]#

Adds a dictionary containing data for multiple new dimensions to a copy of the dataset.data.

Parameters:
datasetDataset

The Dataset to add the dimension to

new_datadict

Dictionary containing new data to add to the Dataset

Returns:
data

A copy of the data with the new data dimensions added

classmethod dtype(dataset, dimension)[source]#

Returns the dtype for the selected dimension.

Parameters:
datasetDataset

The dataset to query

dimensionstr or Dimension

Dimension to return the dtype for

Returns:
numpy.dtype

The dtype of the selected dimension

classmethod has_holes(dataset)[source]#

Whether the Dataset contains geometries with holes.

Parameters:
datasetDataset

The dataset to check

Returns:
bool

Whether the Dataset contains geometries with holes

Notes

Only meaningful to implement on Interfaces that support geometry data.

classmethod holes(dataset)[source]#

Returns a list of lists of arrays containing the holes for each geometry in the Dataset.

Parameters:
datasetDataset

The dataset to extract holes from

Returns:
list[list[np.ndarray]]

List of list of arrays representing geometry holes

Notes

Only meaningful to implement on Interfaces that support geometry data.

classmethod iloc(dataset, index)[source]#

Implements integer indexing on the rows and columns of the data.

Parameters:
datasetDataset

The dataset to apply the indexing operation on

indextuple or int

Index specification (row_index, col_index) or row_index

Returns:
data

Indexed data

Notes

Only implement for tabular interfaces.

classmethod isscalar(dataset, dim, per_geom=False)[source]#

Tests if dimension is scalar in each subpath.

classmethod length(dataset)[source]#

Returns the length of the multi-tabular dataset making it appear like a single array of concatenated subpaths separated by NaN values.

classmethod nonzero(dataset)[source]#

Returns a boolean indicating whether the Dataset contains any data.

Parameters:
datasetDataset

The dataset to check

Returns:
bool

Whether the dataset is not empty

classmethod range(dataset, dim)[source]#

Computes the minimum and maximum value along a dimension.

Parameters:
datasetDataset

The dataset to query

dimensionstr or Dimension

Dimension to compute the range on

Returns:
tuple[Any, Any]

Tuple of (min, max) values

Notes

In the past categorical and string columns were handled by sorting the values and taking the first and last value. This behavior is deprecated and will be removed in 2.0. In future the range for these columns will be returned as (None, None).

classmethod redim(dataset, dimensions)[source]#

Renames dimensions in the data.

Parameters:
datasetDataset

The dataset to transform

dimensionsdict[str, str]

Dictionary mapping from old to new dimension names

Returns:
data

Data after the dimension names have been transformed

Notes

Only meaningful for data formats that store dimension names.

classmethod reindex(dataset, kdims=None, vdims=None)[source]#

Reindexes data given new key and value dimensions.

classmethod select(dataset, selection_mask=None, **selection)[source]#

Applies selectiong on all the subpaths.

classmethod select_paths(dataset, index)[source]#

Allows selecting paths with usual NumPy slicing index.

classmethod shape(dataset)[source]#

Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.

classmethod split(dataset, start, end, datatype, **kwargs)[source]#

Splits a multi-interface Dataset into regular Datasets using regular tabular interfaces.

classmethod validate(dataset, vdims=True)[source]#

Validation runs after the Dataset has been constructed and should validate that the Dataset is correctly formed and contains all declared dimensions.

classmethod values(dataset, dimension, expanded=True, flat=True, compute=True, keep_index=False)[source]#

Returns a single concatenated array of all subpaths separated by NaN values. If expanded keyword is False an array of arrays is returned.

holoviews.core.data.multipath.ensure_ring(geom, values=None)[source]#

Ensure the (multi-)geometry forms a ring.

Checks the start- and end-point of each geometry to ensure they form a ring, if not the start point is inserted at the end point. If a values array is provided (which must match the geometry in length) then the insertion will occur on the values instead, ensuring that they will match the ring geometry.

Parameters:
geom

2-D array of geometry coordinates

values

Optional array of values

Returns:
Array where values have been inserted and ring closing indexes