polars.Series.str.strip_chars_start#

Series.str.strip_chars_start(characters: IntoExprColumn | None = None) Series[source]#

Remove leading characters.

Parameters:
characters

The set of characters to be removed. All combinations of this set of characters will be stripped from the start of the string. If set to None (default), all leading whitespace is removed instead.

Examples

>>> s = pl.Series([" hello ", "\tworld"])
>>> s.str.strip_chars_start()
shape: (2,)
Series: '' [str]
[
        "hello "
        "world"
]

Characters can be stripped by passing a string as argument. Note that whitespace will not be stripped automatically when doing so.

>>> s.str.strip_chars_start("wod\t")
shape: (2,)
Series: '' [str]
[
        " hello "
        "rld"
]