MCPcopy Create free account
hub / github.com/ahalev/python-microgrid / state_series

Method state_series

src/pymgrid/microgrid/microgrid.py:790–815  ·  view source on GitHub ↗

State of the microgrid as a pandas Series. Three are three levels in the MultiIndex: ``microgrid_name``, ``microgrid_number`` (relative to each ``microgrid_name``) and state key name. Parameters ---------- normalized : bool, default False

(self, normalized=False)

Source from the content-addressed store, hash-verified

788 return self.get_log()
789
790 def state_series(self, normalized=False):
791 """
792 State of the microgrid as a pandas Series.
793
794 Three are three levels in the MultiIndex: ``microgrid_name``, ``microgrid_number``
795 (relative to each ``microgrid_name``) and state key name.
796
797 Parameters
798 ----------
799 normalized : bool, default False
800 Whether to return a Series of normalized values.
801
802 Returns
803 -------
804 state : pd.Series
805 State of the microgrid as a pandas Series..
806
807 """
808 return pd.Series(
809 {
810 (name, num, key): value
811 for name, sd_list in self.state_dict(normalized=normalized).items()
812 for num, sd in enumerate(sd_list)
813 for key, value in sd.items()
814 }
815 )
816
817 @property
818 def fixed(self):

Calls 1

state_dictMethod · 0.95