cudf.core.column.string.StringMethods.startswith#
- StringMethods.startswith(pat: Union[str, Sequence]) SeriesOrIndex #
Test if the start of each string element matches a pattern.
Equivalent to str.startswith().
- Parameters
- patstr or list-like
If str is an str, evaluates whether each string of series starts with pat. If pat is a list-like, evaluates whether self[i] starts with pat[i]. 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