MCPcopy Index your code
hub / github.com/pydata/xarray / findall

Method findall

xarray/core/accessor_str.py:2280–2371  ·  view source on GitHub ↗

r""" Find all occurrences of pattern or regular expression in the DataArray. Equivalent to applying re.findall() to all the elements in the DataArray. Results in an object array of lists. If there is only one capture group, the lists will be a sequence of matches.

(
        self,
        pat: str | bytes | Pattern | Any,
        case: bool | None = None,
        flags: int = 0,
    )

Source from the content-addressed store, hash-verified

2278 )
2279
2280 def findall(
2281 self,
2282 pat: str | bytes | Pattern | Any,
2283 case: bool | None = None,
2284 flags: int = 0,
2285 ) -> T_DataArray:
2286 r"""
2287 Find all occurrences of pattern or regular expression in the DataArray.
2288
2289 Equivalent to applying re.findall() to all the elements in the DataArray.
2290 Results in an object array of lists.
2291 If there is only one capture group, the lists will be a sequence of matches.
2292 If there are multiple capture groups, the lists will be a sequence of lists,
2293 each of which contains a sequence of matches.
2294
2295 If `pat` is array-like, it is broadcast against the array and applied
2296 elementwise.
2297
2298 Parameters
2299 ----------
2300 pat : str or re.Pattern
2301 A string containing a regular expression or a compiled regular
2302 expression object. If array-like, it is broadcast.
2303 case : bool, default: True
2304 If True, case sensitive.
2305 Cannot be set if `pat` is a compiled regex.
2306 Equivalent to setting the `re.IGNORECASE` flag.
2307 flags : int, default: 0
2308 Flags to pass through to the re module, e.g. `re.IGNORECASE`.
2309 see `compilation-flags <https://docs.python.org/3/howto/regex.html#compilation-flags>`_.
2310 ``0`` means no flags. Flags can be combined with the bitwise or operator ``|``.
2311 Cannot be set if `pat` is a compiled regex.
2312
2313 Returns
2314 -------
2315 extracted : object array
2316
2317 Raises
2318 ------
2319 ValueError
2320 `pat` has no capture groups.
2321 ValueError
2322 `case` is set when `pat` is a compiled regular expression.
2323
2324 Examples
2325 --------
2326 Create a string array
2327
2328 >>> value = xr.DataArray(
2329 ... [
2330 ... [
2331 ... "a_Xy_0",
2332 ... "ab_xY_10-bab_Xy_110-baab_Xy_1100",
2333 ... "abc_Xy_01-cbc_Xy_2210",
2334 ... ],
2335 ... [
2336 ... "abcd_Xy_-dcd_Xy_33210-dccd_Xy_332210",
2337 ... "",

Callers 15

mainFunction · 0.80
countMethod · 0.80
extractallMethod · 0.80
_get_resMethod · 0.80
funcMethod · 0.80

Calls 2

_re_compileMethod · 0.95
_applyMethod · 0.95