add Series.str.remove(pre|suf)fix
State: closed

- [x] closes #36944
- [x] tests added / passed
- [x] Ensure all linting tests pass, see [here](https://pandas.pydata.org/pandas-docs/dev/development/contributing.html#code-standards) for how to run them
- [x] whatsnew entry


Based on work in https://github.com/pandas-dev/pandas/pull/39226

Labels:
name: Enhancement
name: Strings
description: String extension data type and string data

Comments:
I tried `asv continuous -f 1.1 -E virtualenv upstream/master HEAD -b strings` but got

> · Unknown commit upstream/master

Would be good to add a hint to [the docs](https://pandas.pydata.org/docs/development/contributing_codebase.html#running-the-performance-test-suite) to run `git fetch upstream master` in that case.

Also, the following hint in `asv_bench/asv.conf.json` appears to be wrong:

> // The Pythons you'd like to test against.  If not provided, defaults
    // to the current version of Python used to run `asv`.
    // "pythons": ["2.7", "3.4"],
    "pythons": ["3.8"],

I got an error

> · No executable found for python 3.8
· No environments selected

Changing to `"3.9"` and rerunning, I get this error

> ·· Failure creating environment for virtualenv-py3.9-Cython0.29.21-jinja2-matplotlib-numba-numexpr-numpy-odfpy-openpyxl-pyarrow-scipy-sqlalchemy-tables-xlrd-xlsxwriter-xlwt
Traceback (most recent call last):
  File "/Users/janosh/.venv/py39/bin/asv", line 8, in <module>
    sys.exit(main())
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/main.py", line 38, in main
    result = args.func(args)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/__init__.py", line 49, in run_from_args
    return cls.run_from_conf_args(conf, args)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/continuous.py", line 75, in run_from_conf_args
    return cls.run(
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/continuous.py", line 114, in run
    result = Run.run(
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/run.py", line 294, in run
    Setup.perform_setup(environments, parallel=parallel)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/setup.py", line 89, in perform_setup
    list(map(_create, environments))
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/commands/setup.py", line 21, in _create
    env.create()
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/environment.py", line 704, in create
    self._setup()
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/plugins/virtualenv.py", line 148, in _setup
    self._install_requirements()
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/plugins/virtualenv.py", line 172, in _install_requirements
    self._run_pip(args, timeout=self._install_timeout, env=env)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/plugins/virtualenv.py", line 177, in _run_pip
    return self.run_executable('python', ['-mpip'] + list(args), **kwargs)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/environment.py", line 949, in run_executable
    return util.check_output([exe] + args, **kwargs)
  File "/Users/janosh/.venv/py39/lib/python3.9/site-packages/asv/util.py", line 754, in check_output
    raise ProcessError(args, retcode, stdout, stderr)
asv.util.ProcessError: Command '/Users/janosh/Repos/pandas/asv_bench/env/94b401bb918963c7d4d914702f131a3f/bin/python -mpip install -v --upgrade numpy Cython==0.29.21 matplotlib sqlalchemy scipy numba numexpr pyarrow tables openpyxl xlsxwriter xlrd xlwt odfpy jinja2' returned non-zero exit status 1

Does the Python interpreter have to be in a clean virtualenv or something like that?
I think I need some help here fixing this error:

```py
+ pytest -m 'not slow and not network and not clipboard' pandas --junitxml=test-data.xml
ImportError while loading conftest '/pandas/pandas/conftest.py'.
pandas/__init__.py:46: in <module>
    from pandas.core.api import (
pandas/core/api.py:29: in <module>
    from pandas.core.arrays import Categorical
pandas/core/arrays/__init__.py:7: in <module>
    from pandas.core.arrays.categorical import Categorical
pandas/core/arrays/categorical.py:113: in <module>
    from pandas.core.strings.object_array import ObjectStringArrayMixin
pandas/core/strings/__init__.py:31: in <module>
    from pandas.core.strings.base import BaseStringArrayMethods
pandas/core/strings/base.py:11: in <module>
    from pandas.core.series import Series
pandas/core/series.py:91: in <module>
    from pandas.core import (
pandas/core/generic.py:111: in <module>
    from pandas.core import (
pandas/core/indexing.py:57: in <module>
    from pandas.core.indexes.api import (
pandas/core/indexes/api.py:11: in <module>
    from pandas.core.indexes.base import (
pandas/core/indexes/base.py:128: in <module>
    from pandas.core.arrays import (
E   ImportError: cannot import name 'Categorical' from partially initialized module 'pandas.core.arrays' (most likely due to a circular import) (/pandas/pandas/core/arrays/__init__.py)
```
@jreback 3 tests timed out after 60 min. Is that equivalent to 'green' or anything still to do?
thanks @janosh very nice!

and @erfannariman for the original!