Slice substrings from each element in the Series or Index.
Start position for slice operation.
Stop position for slice operation.
Step size for slice operation.
Series or Index from sliced substring from original string object.
See also
Series.str.slice_replaceReplace a slice with a string.
Series.str.getReturn element at position. Equivalent to Series.str.slice(start=i, stop=i+1) with i being the position.
Examples
>>> s = pd.Series(["koala", "dog", "chameleon"])
>>> s
0 koala
1 dog
2 chameleon
dtype: object
>>> s.str.slice(start=1)
0 oala
1 og
2 hameleon
dtype: object
>>> s.str.slice(start=-1)
0 a
1 g
2 n
dtype: object
>>> s.str.slice(stop=2)
0 ko
1 do
2 ch
dtype: object
>>> s.str.slice(step=2)
0 kaa
1 dg
2 caeen
dtype: object
>>> s.str.slice(start=0, stop=5, step=3)
0 kl
1 d
2 cm
dtype: object
Equivalent behaviour to:
>>> s.str[0:5:3]
0 kl
1 d
2 cm
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.Series.str.slice.html