pandas.Panel.clip_upper
- 
Panel.clip_upper(threshold, axis=None, inplace=False)[source] - 
Trim values above a given threshold.
Deprecated since version 0.24.0: Use clip(upper=threshold) instead.
Elements above the
thresholdwill be changed to match thethresholdvalue(s). Threshold can be a single value or an array, in the latter case it performs the truncation element-wise.Parameters: - 
threshold : numeric or array-like - 
Maximum value allowed. All values above threshold will be set to this value.
- float : every value is compared to 
threshold. - array-like : The shape of 
thresholdshould match the object it’s compared to. Whenselfis a Series,thresholdshould be the length. Whenselfis a DataFrame,thresholdshould 2-D and the same shape asselfforaxis=None, or 1-D and the same length as the axis being compared. 
 - float : every value is compared to 
 - 
axis : {0 or ‘index’, 1 or ‘columns’}, default 0 - 
Align object with
thresholdalong the given axis. - 
inplace : boolean, default False - 
Whether to perform the operation in place on the data.
New in version 0.21.0.
 
Returns: - Series or DataFrame
 - 
Original data with values trimmed.
 
See also
- 
 
Series.clip - General purpose method to trim Series values to given threshold(s).
 - 
 
DataFrame.clip - General purpose method to trim DataFrame values to given threshold(s).
 
Examples
>>> s = pd.Series([1, 2, 3, 4, 5]) >>> s 0 1 1 2 2 3 3 4 4 5 dtype: int64
>>> s.clip(upper=3) 0 1 1 2 2 3 3 3 4 3 dtype: int64
>>> elemwise_thresholds = [5, 4, 3, 2, 1] >>> elemwise_thresholds [5, 4, 3, 2, 1]
>>> s.clip(upper=elemwise_thresholds) 0 1 1 2 2 3 3 2 4 1 dtype: int64
 - 
 
    © 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
    https://pandas.pydata.org/pandas-docs/version/0.24.2/reference/api/pandas.Panel.clip_upper.html