scipy.stats.
find_repeats#
- scipy.stats.find_repeats(arr)[原始碼]#
尋找重複值與重複計數。
版本 1.15.0 開始棄用:此函數從 SciPy 1.15.0 版本開始已棄用,並將在 SciPy 1.17.0 版本中移除。請改用
numpy.unique
/ numpy.unique_counts。- 參數:
- arrarray_like
輸入陣列。這會被轉換為 float64。
- 回傳值:
- valuesndarray
來自(展平的)輸入中重複的唯一值。
- countsndarray
對應 ‘value’ 重複的次數。
註解
在 numpy >= 1.9 中,
numpy.unique
提供了類似的功能。主要的差異在於find_repeats
只回傳重複的值。範例
>>> 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]))