turicreate.SArray.clip¶
-
SArray.
clip
(lower=nan, upper=nan)¶ Create a new SArray with each value clipped to be within the given bounds.
In this case, “clipped” means that values below the lower bound will be set to the lower bound value. Values above the upper bound will be set to the upper bound value. This function can operate on SArrays of numeric type as well as array type, in which case each individual element in each array is clipped. By default
lower
andupper
are set tofloat('nan')
which indicates the respective bound should be ignored. The method fails if invoked on an SArray of non-numeric type.Parameters: - lower : int, optional
The lower bound used to clip. Ignored if equal to
float('nan')
(the default).- upper : int, optional
The upper bound used to clip. Ignored if equal to
float('nan')
(the default).
Returns: - out : SArray
See also
Examples
>>> sa = turicreate.SArray([1,2,3]) >>> sa.clip(2,2) dtype: int Rows: 3 [2, 2, 2]