當前位置: 首頁>>編程示例 >>用法及示例精選 >>正文


Python SciPy mstats.find_repeats用法及代碼示例

本文簡要介紹 python 語言中 scipy.stats.mstats.find_repeats 的用法。

用法:

scipy.stats.mstats.find_repeats(arr)#

查找 arr 中的重複項並返回一個元組(repeats, repeat_count)。

輸入被轉換為 float64。屏蔽值將被丟棄。

參數

arr 序列

輸入數組。如果數組不是一維,則數組將被展平。

返回

repeats ndarray

重複值的數組。

counts ndarray

計數數組。

例子

>>> 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次。

相關用法


注:本文由純淨天空篩選整理自scipy.org大神的英文原創作品 scipy.stats.mstats.find_repeats。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。