pypsa.Network.import_series_from_dataframe#
- Network.import_series_from_dataframe(dataframe: pd.DataFrame, cls_name: str, attr: str) None #
Import time series from a pandas DataFrame.
This function is deprecated. Use
pypsa.Network.add()
instead, but it will not work with the same data structure. To get a similar behavior, use n.dynamic(class_name)[attr] = df but make sure that the index is aligned. Also note that this is overwriting the attribute dataframe, not adding to it as before. It is better to usepypsa.Network.add()
to import time series data.- Parameters:
dataframe (pandas.DataFrame) – A DataFrame whose index is
n.snapshots
and whose columns are a subset of the relevant components.cls_name (string) – Name of class of component
attr (string) – Name of time-varying series attribute
Examples
>>> import numpy as np >>> n.set_snapshots(range(10)) >>> n.import_series_from_dataframe( ... pd.DataFrame(np.random.rand(10, 4), ... columns=n.generators.index, ... index=range(10)), ... "Generator", ... "p_max_pu")
Deprecated since version 0.29: This will be removed in 1.0. Use n.add instead.