polars.Series.cat.starts_with#

Series.cat.starts_with(prefix: str) Series[source]#

Check if string representations of values start with a substring.

Parameters:
prefix

Prefix substring.

See also

contains

Check if the string repr contains a substring that matches a pattern.

ends_with

Check if string repr ends with a substring.

Examples

>>> s = pl.Series("fruits", ["apple", "mango", None], dtype=pl.Categorical)
>>> s.cat.starts_with("app")
shape: (3,)
Series: 'fruits' [bool]
[
    true
    false
    null
]