Series.str.startswith(self, pat, na=nan)
[source]
Test if the start of each string element matches a pattern.
Equivalent to str.startswith()
.
Parameters: |
|
---|---|
Returns: |
|
See also
str.startswith
Series.str.endswith
Series.str.contains
>>> s = pd.Series(['bat', 'Bear', 'cat', np.nan]) >>> s 0 bat 1 Bear 2 cat 3 NaN dtype: object
>>> s.str.startswith('b') 0 True 1 False 2 False 3 NaN dtype: object
Specifying na
to be False
instead of NaN
.
>>> s.str.startswith('b', na=False) 0 True 1 False 2 False 3 False dtype: bool
© 2008–2012, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/0.25.0/reference/api/pandas.Series.str.startswith.html