Advanced filtering

pyam includes a function to directly downselect a pandas.DataFrame with appropriate columns or index dimensions (i.e., ['model', 'scenario']) using a IamDataFrame and keyword arguments similar to the IamDataFrame.filter() function.

pyam.filter_by_meta(data, df, join_meta=False, **kwargs)[source]

Filter by and join meta columns from an IamDataFrame to a pd.DataFrame


Data to which meta columns are to be joined, index or columns must include [‘model’, ‘scenario’]


IamDataFrame from which meta columns are filtered and joined (optional)

join_metabool, optional

join selected columns from df.meta on data


Meta columns to be filtered/joined, where col=… applies filters with the given arguments (using utils.pattern_match()). Using col=None joins the column without filtering (setting col to nan if (model, scenario) not in df.meta.index)