Model database utilities

Common code for data input.

item.model.common.concat_versions(dataframes={})[source]

Convert a dict of dataframes to a single pd.DataFrame.

The keys of dataframes are saved in a new column ‘version’.

item.model.common.data_columns(df)[source]

Return a sorted list of non-index columns in pandas.Dataframe df.

item.model.common.drop_empty(df, columns=None)[source]

Drop rows in df where the data columns are all empty.

The number of dropped rows is logged. If columns, an iterable of column names, is given, drop on these columns instead.

item.model.common.load()[source]

Load model & scenario data.

item.model.common.select(data, *args, **kwargs)[source]

Select from data.

item.model.common.to_wide(data, dimension='year')[source]

Convert data to wide format, one column per year.