A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/reference/api/pandas.Series.str.removesuffix.html below:

pandas.Series.str.removesuffix — pandas 2.3.1 documentation

pandas.Series.str.removesuffix#
Series.str.removesuffix(suffix)[source]#

Remove a suffix from an object series.

If the suffix is not present, the original string will be returned.

Parameters:
suffixstr

Remove the suffix of the string.

Returns:
Series/Index: object

The Series or Index with given suffix removed.

Examples

>>> s = pd.Series(["str_foo", "str_bar", "no_prefix"])
>>> s
0    str_foo
1    str_bar
2    no_prefix
dtype: object
>>> s.str.removeprefix("str_")
0    foo
1    bar
2    no_prefix
dtype: object
>>> s = pd.Series(["foo_str", "bar_str", "no_suffix"])
>>> s
0    foo_str
1    bar_str
2    no_suffix
dtype: object
>>> s.str.removesuffix("_str")
0    foo
1    bar
2    no_suffix
dtype: object

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4