pypsa.Network.get_switchable_as_dense

pypsa.Network.get_switchable_as_dense#

Network.get_switchable_as_dense(component: str, attr: str, snapshots: Sequence | None = None, inds: pd.Index | None = None) pd.DataFrame#

Return a Dataframe for a time-varying component attribute with values for all non-time-varying components filled in with the default values for the attribute.

Parameters:
  • n (pypsa.Network)

  • component (string) – Component object name, e.g. ‘Generator’ or ‘Link’

  • attr (string) – Attribute name

  • snapshots (pandas.Index) – Restrict to these snapshots rather than n.snapshots.

  • inds (pandas.Index) – Restrict to these components rather than n.components.index

Return type:

pandas.DataFrame

Examples

>>> import pypsa
>>> n = pypsa.examples.ac_dc_meshed()
>>> get_switchable_as_dense(n, 'Generator', 'p_max_pu', n.snapshots[:2]) 
Generator            Manchester Wind  Manchester Gas  Norway Wind  Norway Gas  Frankfurt Wind  Frankfurt Gas
snapshot
2015-01-01 00:00:00         0.930020             1.0     0.974583         1.0        0.559078            1.0
2015-01-01 01:00:00         0.485748             1.0     0.481290         1.0        0.752910            1.0