pandas.Series.str.match
- Series.str.match(pat, case=True, flags=0, na=<no_default>)[source]
-
Determine if each string starts with a match of a regular expression.
- Parameters:
-
- pat:str
-
Character sequence.
- case:bool, default True
-
If True, case sensitive.
- flags:int, default 0 (no flags)
-
Regex module flags, e.g. re.IGNORECASE.
- na:scalar, optional
-
Fill value for missing values. The default depends on dtype of the array. For object-dtype,
numpy.nan
is used. For the nullableStringDtype
,pandas.NA
is used. For the"str"
dtype,False
is used.
- Returns:
-
- Series/Index/array of boolean values
See also
Examples
>>> ser = pd.Series(["horse", "eagle", "donkey"]) >>> ser.str.match("e") 0 False 1 True 2 False dtype: bool
© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.Series.str.match.html