Home

scipyspatial

scipy.spatial is a subpackage of SciPy that provides algorithms and data structures for geometric problems. It offers tools for distance computation, spatial indexing, and tessellations, and works with NumPy arrays across multiple dimensions. The module is designed to support scientific computing workflows that require spatial reasoning.

Distance computations are organized under scipy.spatial.distance. It includes functions such as pdist, cdist, and squareform, enabling

Nearest-neighbor searches rely on KDTree and cKDTree, providing fast queries for nearest, radius-based, and range-limited neighbor

Spatial tessellations and hulls are provided via Voronoi, Delaunay, and ConvexHull classes. These constructs enable geometric

scipy.spatial is a core part of SciPy and relies on NumPy. It is widely used in data

pairwise
distances
within
a
collection
and
between
two
collections.
A
variety
of
distance
metrics
are
supported,
including
Euclidean,
Manhattan,
and
cosine,
making
it
suitable
for
similarity
search
and
clustering
preparation.
searches.
These
structures
support
methods
like
query
and
query_ball_point
to
retrieve
the
closest
points
or
all
points
within
a
radius,
with
performance
benefits
in
moderate
dimensions.
partitioning
and
mesh
generation
in
one
or
more
dimensions.
The
implementations
typically
rely
on
the
underlying
Qhull
library
and
are
applicable
to
a
wide
range
of
dimensionalities,
though
performance
degrades
in
very
high
dimensions.
analysis,
geographic
information
systems,
computer
graphics,
and
machine
learning
pipelines
for
tasks
such
as
distance-based
retrieval,
spatial
clustering
preparation,
and
geometric
computations.