pymrio.Extension.match

Extension.match(find_all=None, **kwargs)

Check if index of the system match the regex pattern

Similar to pandas str.match, thus the start of the index string must match. Uses ioutil.index_match

The index levels need to be named (df.index.name needs to be set for all levels).

Note

Arguments are set to case=True, flags=0, na=False, regex=True. For case insensitive matching, use (?i) at the beginning of the pattern.

See the pandas/python.re documentation for more details.

Parameters
  • find_all (None or str) – If str (regex pattern) search for all matches in all index levels. All matching rows are returned. The remaining kwargs are ignored.

  • kwargs (dict) – The regex to match. The keys are the index names, the values are the regex to match. If the entry is not in index name, it is ignored silently.

Returns

The matched rows/index

Return type

pd.Index or pd.MultiIndex