Skip to content

duplicates builtin

duplicates(
    coords, *, tolerance=0.0, merge=None, weights=None
)

Samples at most tolerance apart, grouped, and optionally merged.

Grouping is transitive: samples further apart share a group when a chain of close samples links them. Groups are numbered by their first row.

Parameters:

Name Type Description Default
coords PointSet or array_like

Samples, or their (n, 2) or (n, 3) coordinates.

required
tolerance float

Largest distance between duplicates; 0 groups samples at exactly the same location.

0.0
merge (mean, first, max)

Merge each group into one sample at its first sample's location; needs a PointSet. Numeric columns become float: mean is weighted by weights (by count without), max is each column's own maximum, both skipping nulls; first is the first sample's value. Other columns take the first sample's value.

"mean"
weights array_like or str

Weights of merge="mean", e.g. composite lengths, or their column.

None

Returns:

Name Type Description
report Table

Without merge: one row per group, group, n samples, x, y, z of the first sample and spread, the largest distance from it.

group ndarray of int64

Without merge: the group of each sample, -1 for samples alone.

merged PointSet

With merge, instead: the samples alone and one per group, in row order, with an n column counting the samples merged into each.

used in