scipy.stats.mstats.
find_repeats#
- scipy.stats.mstats.find_repeats(arr)[source]#
在 arr 中尋找重複值並傳回一個元組 (repeats, repeat_count)。
輸入會被轉換為 float64 型別。遮罩值會被捨棄。
- 參數:
- arr序列
輸入陣列。若陣列不是一維,將會被展平。
- 回傳:
- repeatsndarray
重複值的陣列。
- countsndarray
計數的陣列。
範例
>>> from scipy.stats import mstats >>> mstats.find_repeats([2, 1, 2, 3, 2, 2, 5]) (array([2.]), array([4]))
在上面的範例中,2 重複了 4 次。
>>> mstats.find_repeats([[10, 20, 1, 2], [5, 5, 4, 4]]) (array([4., 5.]), array([2, 2]))
在上面的範例中,4 和 5 都重複了 2 次。