pandas.Index.str

Index.str()[source]

Vectorized string functions for Series and Index.

NAs stay NA unless handled otherwise by a particular method. Patterned after Python’s string methods, with some inspiration from R’s stringr package.

Examples

>>> s = pd.Series(["A_Str_Series"])
>>> s
0    A_Str_Series
dtype: object
>>> s.str.split("_")
0    [A, Str, Series]
dtype: object
>>> s.str.replace("_", "")
0    AStrSeries
dtype: object

© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Index.str.html