create_empty_ts¶
Inputs¶
- scenarios_dirstr
scenarios
: path to scenarios directory- destinationstr
raw/time_series/empty_ts_efficiencies.csv
: path of output directory for empty ts with efficiencies of all scenariosraw/time_series/empty_ts_feedin.csv
: path of output directory for empty ts with feedins of all scenariosraw/time_series/empty_ts_load.csv
: path of output directory for empty ts with loads of all scenarios
Outputs¶
- pandas.DataFrame
Empty ts in oemof-B3 resource format.
Description¶
The script creates empty DataFrames for load, feed-in and efficiency time series data that serve as template for input data.
- create_empty_ts.create_empty_ts(name)¶
This function provides a Dataframe with a time series of zeros according to the start, periods and freq of the scenario specifications
- Parameters:
name (str) – Name of the ts
- Returns:
df – Dataframe containing ts with zeros as values and name as column name
- Return type:
Dataframe
- create_empty_ts.create_empty_ts_with_zero_or_nan_values(periods, date_rng, name)¶
Returns a pandas DataFrame with time series values set to either zeros or NaNs, based on settings.yaml
- Parameters:
periods (int) – Number of periods in the time series
date_rng (pd.DatetimeIndex) – Datetime index specifying start and end dates of the time series
name (str) – Name of the time series column in the DataFrame
- Returns:
df – A pandas DataFrame containing the time series values, with ‘name’ as the column name.
- Return type:
pd.DataFrame
- Raises:
KeyError – If settings.create_empty_ts.ts_values is not set to either ‘zeros’ or ‘empty’.
- create_empty_ts.drop_duplicates(_df)¶
Remove duplicate rows from a pandas DataFrame based on specified columns.
- Parameters:
_df (pandas DataFrame) – The DataFrame to remove duplicates from.
- Returns:
_df – The updated DataFrame with duplicate rows removed.
- Return type:
pandas DataFrame
Notes
Duplicate rows are determined based on the values in the specified columns. By default, all columns except the “series” column are used to determine duplicates. If there are multiple rows with the same values in the specified columns, only the first occurrence is kept and subsequent occurrences are dropped.
- create_empty_ts.get_df_of_all_empty_ts(profile_names, _region)¶
This function provides a Dataframe with all ts of a profile (load, feedin or efficiency)
Inputs¶
- profile_nameslist
List with names of profiles (loads, feedins or efficiencies)
- _regionstr
Region
Outputs¶
- ts_dfDataframe
Dataframe with empty time series (consisting of zeros)
- create_empty_ts.get_sub_dict(subsub_key, _dict)¶
This function extracts a subsub-dictionary from a dictionary using a subsub-key
Inputs¶
- subsub_keystr
Key of the subsub-dictionary
- _dictdict
Dictionary with two inner dictionaries
Outputs¶
- subsub_dictdictionary
Subsub-dictionary
- create_empty_ts.save_ts(_df, path)¶
This function saves time series that contain values of datetime format Datetime format used: “%Y-%m-%d %H:%M:%S”
- Parameters:
_df (Dataframe) – Dataframe with value(s) of datetime format
path (str) – Path where df is saved to