holoviews.core.data.dictionary module#

class holoviews.core.data.dictionary.DictInterface(*, name)[source]#

Bases: Interface

Interface for simple dictionary-based dataset format. The dictionary keys correspond to the column (i.e. dimension) names and the values are collections representing the values in that column.

Methods

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

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

array(dataset, dimensions)

Returns the data as a numpy.ndarray containing the selected dimensions.

assign(dataset, new_data)

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

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)

Whether the selected dimension is a scalar value.

length(dataset)

Returns the number of rows in the Dataset.

range(dataset, dimension)

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.

shape(dataset)

Returns the shape of the data.

unpack_scalar(dataset, data)

Given a dataset object and data in the appropriate format for the interface, return a simple scalar.

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, dim[, expanded, flat, ...])

Returns the values along a dimension of the dataset.

aggregate

concat

dimension_type

geom_type

groupby

init

mask

sample

select

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 array(dataset, dimensions)[source]#

Returns the data as a numpy.ndarray containing the selected dimensions.

Parameters:
datasetDataset

The dataset to convert

dimensionslist[str]

List of dimensions to include

Returns:
np.ndarray

A Numpy ndarray containing the selected dimensions

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 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)[source]#

Whether the selected dimension is a scalar value.

Parameters:
datasetDataset

The dataset to query

dimstr or Dimension

Dimension to check for scalar value

Returns:
bool

Whether the dimension is scalar

classmethod length(dataset)[source]#

Returns the number of rows in the Dataset.

Parameters:
datasetDataset

The dataset to get the length from

Returns:
int

Length of the data

classmethod range(dataset, dimension)[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, vdims)[source]#

Reindexes data given new key and value dimensions.

classmethod shape(dataset)[source]#

Returns the shape of the data.

Parameters:
datasetDataset

The dataset to get the shape from

Returns:
tuple[int, int]

The shape of the data (rows, cols)

classmethod unpack_scalar(dataset, data)[source]#

Given a dataset object and data in the appropriate format for the interface, return a simple scalar.

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, dim, expanded=True, flat=True, compute=True, keep_index=False)[source]#

Returns the values along a dimension of the dataset.

Parameters:
datasetDataset

The dataset to query

dimensionstr or Dimension

Dimension to return the values for

expandedbool, default True

When false returns unique values along the dimension

flatbool, default True

Whether to flatten the array

computebool, default True

Whether to load lazy data into memory as a NumPy array

keep_indexbool, default False

Whether to return the data with an index (if present)

Returns:
array_like

Dimension values in the requested format

Notes

The expanded keyword has different behavior for gridded interfaces where it determines whether 1D coordinates are expanded into a multi-dimensional array.