Series.clip_upper(self, 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 threshold
will be changed to match the threshold
value(s). Threshold can be a single value or an array, in the latter case it performs the truncation element-wise.
Parameters: |
|
---|---|
Returns: |
|
See also
Series.clip
DataFrame.clip
>>> 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.25.0/reference/api/pandas.Series.clip_upper.html