hipdf.core.column.string.StringMethods.startswith#
21 min read time
Applies to Linux
- StringMethods.startswith(pat: 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#
- endswith
Same as startswith, but tests the end of string.
- contains
Tests if string element contains a pattern.
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