Variables utilities¶
The variable dimension of the pyam
data format implements implements a
“semi-hierarchical” structure using the |
character (pipe, not l or i)
to indicate the depth. Read the data model documentation for more information.
The package provides several functions to work with such strings.
- pyam.str.concat_with_pipe(x, *args, cols=None)[source]¶
Concatenate a list or pandas.Series using
|
, drop None or numpy.nan
- pyam.str.find_depth(data, s='', level=None)[source]¶
Return or assert the depth (number of
|
) of variables- Parameters:
- datastr or list of strings
IAMC-style variables
- sstr, default ‘’
remove leading s from any variable in data
- levelint or str, optional
If None, return depth (number of
|
); else, return list of booleans whether depth satisfies the condition (equality if level is int, >= if.+
, <= if.-
)
- pyam.str.get_variable_components(x, level, join=False)[source]¶
Return components for requested level in a list or join these in a str.
- Parameters:
- xstr
Uses
|
to separate the components of the variable.- levelint or list of int
Position of the component.
- joinbool or str, optional
If True, IAMC-style (
|
) is used as separator for joined components.
- Returns:
- str