cudf.core.accessors.string.StringMethods.startswith#
- StringMethods.startswith(pat: str | tuple[str, ...]) Series | Index[source]#
Test if the start of each string element matches a pattern.
Equivalent to str.startswith().
- Parameters:
- patstr or tuple[str, …]
String pattern or tuple of patterns. Regular expressions are not accepted.
- Returns:
- Series or Index of bool
A Series of booleans indicating whether the given pattern matches the start of each string element.
See also
Examples
>>> import cudf >>> s = cudf.Series(['bat', 'Bear', 'cat', None]) >>> s 0 bat 1 Bear 2 cat 3 <NA> dtype: object >>> s.str.startswith('b') 0 True 1 False 2 False 3 <NA> dtype: bool