pandas 1.4.2

ParametersReturns
removesuffix(self, suffix)

Parameters

suffix : str

Remove the suffix of the string.

Returns

Series/Index: object

The Series or Index with given suffix removed.

Remove a suffix from an object series. If the suffix is not present, the original string will be returned.

See Also

Series.str.removeprefix

Remove a prefix from an object series.

Examples

This example is valid syntax, but we were not able to check execution
>>> s = pd.Series(["str_foo", "str_bar", "no_prefix"])
... s 0 str_foo 1 str_bar 2 no_prefix dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.removeprefix("str_")
0    foo
1    bar
2    no_prefix
dtype: object
This example is valid syntax, but we were not able to check execution
>>> s = pd.Series(["foo_str", "bar_str", "no_suffix"])
... s 0 foo_str 1 bar_str 2 no_suffix dtype: object
This example is valid syntax, but we were not able to check execution
>>> s.str.removesuffix("_str")
0    foo
1    bar
2    no_suffix
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#2027
type: <class 'function'>
Commit: