scipy.stats.tmin(array, lowerlimit=None, axis=0, inclusive=True)
函數沿著指定的軸計算數組元素的修整最小值,並忽略超出指定限製的值。
參數:
array:輸入數組或對象具有要計算最小值的元素。
axis:[默認為零]輸入數組或對象具有要計算最小值的元素。
limits:要考慮的數組的上下限,小於下限或大於上限的值將被忽略。如果限製為“無”(默認),則使用所有值。
inclusive:確定是包括等於下限還是上限的值,或者在計算時排除它們。
返回:基於設置參數的數組元素的幾何平均值。
代碼1:
# Trimmed Minimum
from scipy import stats
import numpy as np
# array elements ranging from 0 to 19
x = [1, 3, 27, 56, 2, 4, 13, 3, 6]
print("Trimmed Minimum:", stats.tmin(x))
print("\nTrimmed Minimum by setting limit:",
stats.tmin(x, (5)))
輸出:
Trimmed Minimum:1 Trimmed Minimum by setting limit: 6
代碼2:檢查不同的參數
# Trimmed Minimum
from scipy import stats
import numpy as np
# array elements ranging from 0 to 19
x = [[1, 3, 27],
[3, 4, 7],
[7, 6, 3],
[3, 6, 8]]
print("Trimmed Minimum:", stats.tmin(x))
# setting axis
print("\nTrimmed Minimum by setting axis:",
stats.tmin(x, axis = 1))
print("\nTrimmed Minimum by setting axis:",
stats.tmin(x, axis = 0))
# setting limit
print("\nTrimmed Minimum by setting limit:",
stats.tmin(x, (5), axis = 1))
print("\nTrimmed Minimum by setting limit:",
stats.tmin(x, (5), axis = 0))
輸出:
Trimmed Minimum:[1 3 3] Trimmed Minimum by setting axis: [1 3 3 3] Trimmed Minimum by setting axis: [1 3 3] Trimmed Minimum by setting limit: [27 7 6 6] Trimmed Minimum by setting limit: [7 6 7]
相關用法
- Python Scipy stats.mean()用法及代碼示例
- Python Scipy stats.sem()用法及代碼示例
- Python Scipy stats.tsem()用法及代碼示例
- Python Scipy stats.binned_statistic_2d()用法及代碼示例
- Python Scipy stats.describe()用法及代碼示例
- Python Scipy stats.tmax()用法及代碼示例
- Python Scipy stats.tstd()用法及代碼示例
- Python Scipy stats.binned_statistic_dd()用法及代碼示例
- Python Scipy stats.binned_statistic()用法及代碼示例
- Python Scipy stats.bayes_mvs()用法及代碼示例
- Python Scipy stats.kurtosistest()用法及代碼示例
- Python Scipy stats.gmean()用法及代碼示例
注:本文由純淨天空篩選整理自vishal3096大神的英文原創作品 scipy stats.tmin() function | Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。