sciPy stats.tmean() | Python
scipy.stats.tmean(array, limits=None, inclusive=(True, True)) calculates the trimmed mean of the array elements along the specified axis of the array.
It’s formula –
array: Input array or object having the elements to calculate the trimmed mean.
axis: Axis along which the trimmed mean is to be computed. By default axis = 0.
limits: Lower and upper bound of the array to consider, values less than the lower limit or greater than the upper limit will be ignored. If limits is None [default], then all values are used.
Returns : Trimmed mean of the array elements based on the set parameters.
Trimmed Mean : 9.5 Trimmed Mean by setting limit : 6.0
Code #2: With multi-dimensional data, axis() working
Trimmed Mean is with default axis = 0 : 42.8333333333