@@ -6014,34 +6014,68 @@ def transpose(self, *args):
6014
6014
return LArray (self .data .transpose (axes_indices ), self .axes [axes_indices ])
6015
6015
T = property (transpose )
6016
6016
6017
- def clip (self , a_min , a_max , out = None ):
6018
- """Clip (limit) the values in an array.
6017
+ def clip (self , minval = None , maxval = None , out = None ):
6018
+ r """Clip (limit) the values in an array.
6019
6019
6020
6020
Given an interval, values outside the interval are clipped to the interval edges.
6021
6021
For example, if an interval of [0, 1] is specified, values smaller than 0 become 0,
6022
6022
and values larger than 1 become 1.
6023
6023
6024
6024
Parameters
6025
6025
----------
6026
- a_min : scalar or array-like
6027
- Minimum value.
6028
- a_max : scalar or array-like
6029
- Maximum value.
6026
+ minval : scalar or array-like, optional
6027
+ Minimum value. If None, clipping is not performed on lower interval edge.
6028
+ Not more than one of `minval` and `maxval` may be None.
6029
+ Defaults to None.
6030
+ maxval : scalar or array-like, optional
6031
+ Maximum value. If None, clipping is not performed on upper interval edge.
6032
+ Not more than one of `minval` and `maxval` may be None.
6033
+ Defaults to None.
6030
6034
out : LArray, optional
6031
6035
The results will be placed in this array.
6032
6036
6033
6037
Returns
6034
6038
-------
6035
6039
LArray
6036
6040
An array with the elements of the current array,
6037
- but where values < `a_min ` are replaced with `a_min `, and those > `a_max ` with `a_max `.
6041
+ but where values < `minval ` are replaced with `minval `, and those > `maxval ` with `maxval `.
6038
6042
6039
6043
Notes
6040
6044
-----
6041
- If `a_min` and/or `a_max` are array_like, broadcast will occur between self, `a_min` and `a_max`.
6045
+ If `minval` and/or `maxval` are array_like, broadcast will occur between self, `minval` and `maxval`.
6046
+
6047
+ Examples
6048
+ --------
6049
+ >>> arr = ndtest((3, 3)) - 3
6050
+ >>> arr
6051
+ a\b b0 b1 b2
6052
+ a0 -3 -2 -1
6053
+ a1 0 1 2
6054
+ a2 3 4 5
6055
+ >>> arr.clip(0, 2)
6056
+ a\b b0 b1 b2
6057
+ a0 0 0 0
6058
+ a1 0 1 2
6059
+ a2 2 2 2
6060
+
6061
+ Clipping on lower interval edge only
6062
+
6063
+ >>> arr.clip(0)
6064
+ a\b b0 b1 b2
6065
+ a0 0 0 0
6066
+ a1 0 1 2
6067
+ a2 3 4 5
6068
+
6069
+ Clipping on upper interval edge only
6070
+
6071
+ >>> arr.clip(maxval=2)
6072
+ a\b b0 b1 b2
6073
+ a0 -3 -2 -1
6074
+ a1 0 1 2
6075
+ a2 2 2 2
6042
6076
"""
6043
6077
from larray .core .npufuncs import clip
6044
- return clip (self , a_min , a_max , out )
6078
+ return clip (self , minval , maxval , out )
6045
6079
6046
6080
@deprecate_kwarg ('transpose' , 'wide' )
6047
6081
def to_csv (self , filepath , sep = ',' , na_rep = '' , wide = True , value_name = 'value' , dropna = None ,
0 commit comments