xarray.DataArray.str.count

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

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 DatArray.

Parameters
  • pat (str) – Valid regular expression.

  • flags (int, default 0, meaning no flags) – Flags for the re module. For a complete list, see here.

Returns

counts

Return type

array of int