scipy.spatial.distance.braycurtis(u, v)[source]

Computes the Bray-Curtis distance between two 1-D arrays.

Bray-Curtis distance is defined as

\[\sum{|u_i-v_i|} / \sum{|u_i+v_i|}\]

The Bray-Curtis distance is in the range [0, 1] if all coordinates are positive, and is undefined if the inputs are of length zero.


u : (N,) array_like

Input array.

v : (N,) array_like

Input array.


braycurtis : double

The Bray-Curtis distance between 1-D arrays u and v.