Skip to content

Commit 86bc86e

Browse files
committed
DOC: improved the docstring of pandas.Series.clip_upper improved
PEP-8 correctios
1 parent da2dac7 commit 86bc86e

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

pandas/core/generic.py

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5638,19 +5638,19 @@ def clip_upper(self, threshold, axis=None, inplace=False):
56385638
Return copy of the input with values above given value(s) truncated.
56395639
56405640
It truncates values above a certain threshold. Threshold can be a
5641-
single value or an array, in the latter case it performs the
5642-
truncation
5641+
single value or an array, in the latter case it performs the truncation
56435642
element-wise.
56445643
56455644
Parameters
56465645
----------
5647-
threshold : float or array_like
5648-
Maximum value allowed. All values above threshold will be
5649-
set to this value.
5646+
threshold : float or array-like
5647+
Maximum value allowed. All values above threshold will be set to
5648+
this value.
56505649
axis : int or string axis name, optional
56515650
Align object with threshold along the given axis.
5652-
inplace : boolean, default False
5651+
inplace : bool, default False
56535652
Whether to perform the operation in place on the data.
5653+
.. versionadded:: 0.21.0.
56545654
56555655
See Also
56565656
--------
@@ -5663,39 +5663,33 @@ def clip_upper(self, threshold, axis=None, inplace=False):
56635663
56645664
Examples
56655665
--------
5666-
>>> s = pd.Series([1,2,3,4,5,6,7])
5666+
>>> s = pd.Series([1, 2, 3, 4, 5])
56675667
>>> s
56685668
0 1
56695669
1 2
56705670
2 3
56715671
3 4
56725672
4 5
5673-
5 6
5674-
6 7
56755673
dtype: int64
56765674
5677-
>>> s.clip_upper(4)
5675+
>>> s.clip_upper(3)
56785676
0 1
56795677
1 2
56805678
2 3
5681-
3 4
5682-
4 4
5683-
5 4
5684-
6 4
5679+
3 3
5680+
4 3
56855681
dtype: int64
56865682
5687-
>>> t = [4,8,7,2,5,4,6]
5683+
>>> t = [5, 4, 3, 2, 1]
56885684
>>> t
5689-
[4, 8, 7, 2, 5, 4, 6]
5685+
[5, 4, 3, 2, 1]
56905686
56915687
>>> s.clip_upper(t)
56925688
0 1
56935689
1 2
56945690
2 3
56955691
3 2
5696-
4 5
5697-
5 4
5698-
6 6
5692+
4 1
56995693
dtype: int64
57005694
"""
57015695
return self._clip_with_one_bound(threshold, method=self.le,
@@ -5719,7 +5713,7 @@ def clip_lower(self, threshold, axis=None, inplace=False):
57195713
57205714
See Also
57215715
--------
5722-
clip:
5716+
clip : Return input copy with values below/above thresholds truncated.
57235717
57245718
Returns
57255719
-------
@@ -5903,6 +5897,7 @@ def at_time(self, time, asof=False):
59035897
Parameters
59045898
----------
59055899
time : datetime.time or string
5900+
asof :
59065901
59075902
Returns
59085903
-------

0 commit comments

Comments
 (0)