Skip to content

Commit

Permalink
Use FastJSON instead
Browse files Browse the repository at this point in the history
* fix pandas warning in latest version
  • Loading branch information
maurerle committed Sep 22, 2023
1 parent 1c74658 commit 7c96fec
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions assume/common/mango_serializer.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import pickle

from mango.messages.codecs import JSON, GenericProtoMsg
from mango.messages.codecs import FastJSON, GenericProtoMsg


def generic_json_serializer():
Expand Down Expand Up @@ -29,6 +29,6 @@ def __fromstring__(data):


def mango_codec_factory():
codec = JSON()
codec = FastJSON()
codec.add_serializer(*generic_json_serializer())
return codec
5 changes: 3 additions & 2 deletions assume/common/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down

0 comments on commit 7c96fec

Please sign in to comment.