xarray.core.accessor_str.StringAccessor.count
xarray.core.accessor_str.StringAccessor.count#
- StringAccessor.count(pat, flags=0, case=None)[source]#
Count occurrences of pattern in each string of the array.
This function is used to count the number of times a particular regex pattern is repeated in each of the string elements of the
DataArray.The pattern pat can either be a single
stror re.Pattern or array-like ofstror re.Pattern. If array-like, it is broadcast against the array and applied elementwise.- Parameters
pat (
strorre.Patternor array-like ofstrorre.Pattern) – A string containing a regular expression or a compiled regular expression object. If array-like, it is broadcast.flags (
int, default:0) – Flags to pass through to the re module, e.g. re.IGNORECASE. see compilation-flags.0means no flags. Flags can be combined with the bitwise or operator|. Cannot be set if pat is a compiled regex.case (
bool, default:True) – If True, case sensitive. Cannot be set if pat is a compiled regex. Equivalent to setting the re.IGNORECASE flag.
- Returns