pandas.Series.str.count

pandas 3.1.1 · Series and accessors · method

Count nonoverlapping regex matches separately in each string.

Call syntax

Series.str.count(pat, flags=0)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
pat Required
Positional or keyword
str

Specify the substring or regular expression to match.

flags Optional
Positional or keyword
Default 0
int

Pass regular-expression modifiers such as re.IGNORECASE.

Returns

Series or Index