holoviews.core.data.spatialpandas module#
- class holoviews.core.data.spatialpandas.SpatialPandasInterface(*, name)[source]#
Bases:
MultiInterface
Methods
applies
(obj)Indicates whether the interface is designed specifically to handle the supplied object's type.
as_dframe
(dataset)Returns the data of a Dataset as a dataframe avoiding copying if it already a dataframe type.
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.
loaded
()Indicates whether the required dependencies are loaded.
select
(dataset[, selection_mask])Applies selectiong on all the subpaths.
select_mask
(dataset, selection)Given a Dataset object and a dictionary with dimension keys and selection keys (i.e. tuple ranges, slices, sets, lists, or literals) return a boolean mask over the rows in the Dataset object that have been selected.
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.
values
(dataset, dimension[, expanded, flat, ...])Returns a single concatenated array of all subpaths separated by NaN values.
add_dimension
aggregate
array_type
base_interface
data_types
dframe
dimension_type
dtype
frame_type
geo_column
geom_dims
groupby
has_holes
holes
iloc
init
nonzero
range
redim
reindex
sample
series_type
sort
validate
Parameter Definitions
- classmethod applies(obj)[source]#
Indicates whether the interface is designed specifically to handle the supplied object’s type. By default simply checks if the object is one of the types declared on the class, however if the type is expensive to import at load time the method may be overridden.
- classmethod as_dframe(dataset)[source]#
Returns the data of a Dataset as a dataframe avoiding copying if it already a dataframe type.
- base_interface[source]#
alias of
PandasInterface
- 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 select(dataset, selection_mask=None, **selection)[source]#
Applies selectiong on all the subpaths.
- classmethod select_mask(dataset, selection)[source]#
Given a Dataset object and a dictionary with dimension keys and selection keys (i.e. tuple ranges, slices, sets, lists, or literals) return a boolean mask over the rows in the Dataset object that have been selected.
- classmethod shape(dataset)[source]#
Returns the shape of all subpaths, making it appear like a single array of concatenated subpaths separated by NaN values.
- holoviews.core.data.spatialpandas.from_multi(eltype, data, kdims, vdims)[source]#
Converts list formats into spatialpandas.GeoDataFrame.
- Parameters:
- eltype
Element type to convert
- data
The original data
- kdims
The declared key dimensions
- vdims
The declared value dimensions
- Returns:
A
GeoDataFrame
containing
in
the
list
based
format.
- holoviews.core.data.spatialpandas.from_shapely(data)[source]#
Converts shapely based data formats to spatialpandas.GeoDataFrame.
- Parameters:
- data
A list of shapely objects or dictionaries containing shapely objects
- Returns:
A
GeoDataFrame
containing
the
shapely
geometry
data.
- holoviews.core.data.spatialpandas.geom_array_to_array(geom_array, index, expand=False, geom_type=None)[source]#
Converts spatialpandas extension arrays to a flattened array.
- Parameters:
- geom
spatialpandas
geometry
- index
The column index to return
- geom
- Returns:
Flattened
array
- holoviews.core.data.spatialpandas.geom_to_array(geom, index=None, multi=False, geom_type=None)[source]#
Converts spatialpandas geometry to an array.
- Parameters:
- geom
spatialpandas
geometry
- index
The column index to return
- multi
Whether to concatenate multiple arrays or not
- geom
- Returns:
Array
orlist
of
arrays.
- holoviews.core.data.spatialpandas.geom_to_holes(geom)[source]#
Extracts holes from spatialpandas Polygon geometries.
- Parameters:
- geom
spatialpandas
geometry
- geom
- Returns:
List
of
arrays
representing
holes
- holoviews.core.data.spatialpandas.get_geom_type(gdf, col)[source]#
Return the HoloViews geometry type string for the geometry column.
- holoviews.core.data.spatialpandas.get_value_array(data, dimension, expanded, keep_index, geom_col, is_points, geom_length=<function geom_length>)[source]#
Returns an array of values from a GeoDataFrame.
- Parameters:
- data
GeoDataFrame
- dimension
The dimension to get the values from
- expanded
Whether to expand the value array
- keep_index
Whether to return a Series
- geom_col
The column in the data that contains the geometries
- is_points
Whether the geometries are points
- geom_length
The function used to compute the length of each geometry
- data
- Returns:
An
array
containing
the
values
along
a
dimension
- holoviews.core.data.spatialpandas.to_geom_dict(eltype, data, kdims, vdims, interface=None)[source]#
Converts data from any list format to a dictionary based format.
- Parameters:
- eltype
Element type to convert
- data
The original data
- kdims
The declared key dimensions
- vdims
The declared value dimensions
- Returns:
A
list
of
dictionaries
containing
geometry
coordinates
and
values.
- holoviews.core.data.spatialpandas.to_spatialpandas(data, xdim, ydim, columns=None, geom='point')[source]#
Converts list of dictionary format geometries to spatialpandas line geometries.
- Parameters:
- data
List of dictionaries representing individual geometries
- xdim
Name of x-coordinates column
- ydim
Name of y-coordinates column
- columns
List of columns to add
- geom
The type of geometry
- Returns:
A
spatialpandas.GeoDataFrame
version
of
the
data