cudf.core.column.string.StringMethods.lstrip#

StringMethods.lstrip(to_strip: str | None = None) SeriesOrIndex#

Remove leading and trailing characters.

Strip whitespaces (including newlines) or a set of specified characters from each string in the Series/Index from left side. Equivalent to str.lstrip().

Parameters:
to_stripstr or None, default None

Specifying the set of characters to be removed. All combinations of this set of characters will be stripped. If None then whitespaces are removed.

Returns:
Series or Index of object

See also

strip

Remove leading and trailing characters in Series/Index.

rstrip

Remove trailing characters in Series/Index.

Examples

>>> import cudf
>>> s = cudf.Series(['1. Ant.  ', '2. Bee!\n', '3. Cat?\t', None])
>>> s.str.lstrip('123.')
0     Ant.
1     Bee!\n
2     Cat?\t
3       <NA>
dtype: object