numpy.clip()

numpy.clip

numpy.clip(a, a_min, a_max, out=None) [source]

Clip (limit) the values in an array.

Given an interval, values outside the interval are clipped to the interval edges. For example, if an interval of [0, 1] is specified, values smaller than 0 become 0, and values larger than 1 become 1.

Parameters:

a : array_like

Array containing elements to clip.

a_min : scalar or array_like

Minimum value.

登录查看完整内容