str.
rstrip
Remove trailing characters.
Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from right side. Equivalent to str.rstrip().
str.rstrip()
Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.
Examples
>>> s = ps.Series(['1. Ant.', '2. Bee!\t', None]) >>> s 0 1. Ant. 1 2. Bee!\t 2 None dtype: object
>>> s.str.rstrip('.!\t') 0 1. Ant 1 2. Bee 2 None dtype: object