scipy.stats.mstats.

find_repeats#

scipy.stats.mstats.find_repeats(arr)[source]#

Find repeats in arr and return a tuple (repeats, repeat_count).

The input is cast to float64. Masked values are discarded.

Parameters:
arrsequence

Input array. The array is flattened if it is not 1D.

Returns:
repeatsndarray

Array of repeated values.

countsndarray

Array of counts.

Examples

>>> from scipy.stats import mstats
>>> mstats.find_repeats([2, 1, 2, 3, 2, 2, 5])
(array([2.]), array([4]))

In the above example, 2 repeats 4 times.

>>> mstats.find_repeats([[10, 20, 1, 2], [5, 5, 4, 4]])
(array([4., 5.]), array([2, 2]))

In the above example, both 4 and 5 repeat 2 times.