modin.pandas.Series.str.count¶
- Series.str.count(pat, flags=0)[source]¶
Count occurrences of pattern in each string of the Series/Index.
This function is used to count the number of times a particular regex pattern is repeated in each of the string elements of the Series.
- Parameters:
pat (str) – Valid regular expression.
flags (int, default 0, meaning no flags) – Flags for the re module.
**kwargs – For compatibility with other string methods. Not used.
- Returns:
Same type as the calling object containing the integer counts.
- Return type:
See also
reStandard library module for regular expressions.
str.countStandard library version, without regular expression support.
Notes
Some characters need to be escaped when passing in pat. eg. ‘$’ has a special meaning in regex and must be escaped when finding this literal character.
Examples
Escape ‘$’ to find the literal dollar sign.
This is also available on Index