bigframes.pandas.api.typing.StringMethods.slice#

StringMethods.slice(start: int | None = None, stop: int | None = None) T[source]#

Slice substrings from each element in the Series or Index.

Examples:

>>> import bigframes.pandas as bpd
>>> s = bpd.Series(["koala", "dog", "chameleon"])
>>> s
0        koala
1          dog
2    chameleon
dtype: string
>>> s.str.slice(start=1)
0        oala
1          og
2    hameleon
dtype: string
>>> s.str.slice(stop=2)
0    ko
1    do
2    ch
dtype: string
>>> s.str.slice(start=2, stop=5)
0    ala
1      g
2    ame
dtype: string
Parameters:
  • start (int, optional) – Start position for slice operation.

  • stop (int, optional) – Stop position for slice operation.

  • step (int, optional) – Step size for slice operation.

Returns:

bigframes.series.Series:: Series or Index from sliced

substring from original string object.