You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The below exemplar scenario definition -- wherein we attempt to over-write in draw_parameters a parameter that is defined either as a pd.Series or a pd.DataFrame -- fails with this error:
TypeError: Object of type DataFrame is not JSON serializable
But, many parameters that need to be overwritten are in the format!
Sadly, it's not a simple fix. We write out the full specification for the scenario draws in a JSON file so they can run in parallel and independently. To faciliate that, the decision was made to only support overriding parameters with simple scalars. This was extended to other native Python types (e.g. list).
Scalars, list and dicts can be serialised to and from JSON natively, without any post-processing. However, Pandas Series and Dataframes will require the storage of extra metadata to make sure they are restored using the Pandas to/from_json methods, with the right types etc. We can do that, but it'll need to be done carefully.
For now, I recommend that modules accept overridden parameters as scalars, lists or dicts and then, inside the module, handle any conversion to a Series or Dataframe.
The below exemplar scenario definition -- wherein we attempt to over-write in
draw_parameters
a parameter that is defined either as apd.Series
or apd.DataFrame
-- fails with this error:TypeError: Object of type DataFrame is not JSON serializable
But, many parameters that need to be overwritten are in the format!
The text was updated successfully, but these errors were encountered: