scipy.stats.find_repeats

scipy.stats.find_repeats(arr)[source]

Find repeats and repeat counts.

Parameters
arrarray_like

Input array. This is cast to float64.

Returns
valuesndarray

The unique values from the (flattened) input that are repeated.

countsndarray

Number of times the corresponding ‘value’ is repeated.

Notes

In numpy >= 1.9 numpy.unique provides similar functionality. The main difference is that find_repeats only returns repeated values.

Examples

>>> from scipy import stats
>>> stats.find_repeats([2, 1, 2, 3, 2, 2, 5])
RepeatedResults(values=array([2.]), counts=array([4]))
>>> stats.find_repeats([[10, 20, 1, 2], [5, 5, 4, 4]])
RepeatedResults(values=array([4.,  5.]), counts=array([2, 2]))