scipy.stats.mstats.trim

scipy.stats.mstats.trim(a, limits=None, inclusive=(True, True), relative=False, axis=None)

Trims an array by masking the data outside some given limits.

Returns a masked version of the input array.

Parameters :

a : sequence

Input array

limits : {None, tuple} optional

If relative == False, tuple (lower limit, upper limit) in absolute values. Values of the input array lower (greater) than the lower (upper) limit are masked. If relative == True, tuple (lower percentage, upper percentage) to cut on each side of the array, with respect to the number of unmasked data. Noting n the number of unmasked data before trimming, the (n*limits[0])th smallest data and the (n*limits[1])th largest data are masked, and the total number of unmasked data after trimming is n*(1.-sum(limits)) In each case, the value of one limit can be set to None to indicate an open interval. If limits is None, no trimming is performed

inclusive : {(True, True) tuple} optional

If relative==False, tuple indicating whether values exactly equal to the absolute limits are allowed. If relative==True, tuple indicating whether the number of data being masked on each side should be rounded (True) or truncated (False).

relative : {False, True} optional

Whether to consider the limits as absolute values (False) or proportions to cut (True).

axis : {None, integer}, optional

Axis along which to trim.

Examples

>>>z = [ 1, 2, 3, 4, 5, 6, 7, 8, 9,10] >>>trim(z,(3,8)) [–,–, 3, 4, 5, 6, 7, 8,–,–] >>>trim(z,(0.1,0.2),relative=True) [–, 2, 3, 4, 5, 6, 7, 8,–,–]

Previous topic

scipy.stats.mstats.tmin

Next topic

scipy.stats.mstats.trima

This Page