pandas 1.4.2

ParametersReturns
rstrip(self, to_strip=None)

Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from right side. Equivalent to str.rstrip .

Parameters

to_strip : str or None, default None

Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.

Returns

Series or Index of object

Remove trailing characters.

See Also

Series.str.lstrip

Remove leading characters in Series/Index.

Series.str.rstrip

Remove trailing characters in Series/Index.

Series.str.strip

Remove leading and trailing characters in Series/Index.

Examples

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', np.nan])
... s 0 1. Ant. 1 2. Bee!\n 2 3. Cat?\t 3 NaN dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.strip()
0    1. Ant.
1    2. Bee!
2    3. Cat?
3        NaN
dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.lstrip('123.')
0    Ant.
1    Bee!\n
2    Cat?\t
3       NaN
dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.rstrip('.!? \n\t')
0    1. Ant
1    2. Bee
2    3. Cat
3       NaN
dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.strip('123.!? \n\t')
0    Ant
1    Bee
2    Cat
3    NaN
dtype: object
See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/strings/accessor.py#1963
type: <class 'function'>
Commit: