From 7c96fecf75ebe3b0bb2348905e1d3472faa673eb Mon Sep 17 00:00:00 2001 From: Florian Maurer Date: Fri, 22 Sep 2023 11:07:59 +0200 Subject: [PATCH] Use FastJSON instead * fix pandas warning in latest version --- assume/common/mango_serializer.py | 4 ++-- assume/common/outputs.py | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/assume/common/mango_serializer.py b/assume/common/mango_serializer.py index 7cddeae20..66f6164f0 100644 --- a/assume/common/mango_serializer.py +++ b/assume/common/mango_serializer.py @@ -1,6 +1,6 @@ import pickle -from mango.messages.codecs import JSON, GenericProtoMsg +from mango.messages.codecs import FastJSON, GenericProtoMsg def generic_json_serializer(): @@ -29,6 +29,6 @@ def __fromstring__(data): def mango_codec_factory(): - codec = JSON() + codec = FastJSON() codec.add_serializer(*generic_json_serializer()) return codec diff --git a/assume/common/outputs.py b/assume/common/outputs.py index a50a9efc2..dac6bcea5 100644 --- a/assume/common/outputs.py +++ b/assume/common/outputs.py @@ -317,8 +317,9 @@ def write_market_dispatch(self, data): :type data: any """ df = pd.DataFrame(data, columns=["datetime", "power", "market_id", "unit_id"]) - df["simulation"] = self.simulation_id - self.write_dfs["market_dispatch"].append(df) + if not df.empty: + df["simulation"] = self.simulation_id + self.write_dfs["market_dispatch"].append(df) def write_unit_dispatch(self, data): """