json_utils#

predict_backend.utils.json_utils.df_to_json_friendly_dict(df, round_digits=None)#

Dataframe friendly JSON converter

Parameters:
  • df (DataFrame) – Pandas dataframe

  • round_digits (Optional[int]) – bool, whether to round the digits or not

  • load – bool, whether to load the dataframe from JSON after transforming it into a dict and then JSON

Returns:

A dict of the dataframe that is JSON friendly

predict_backend.utils.json_utils.to_json(data)#

Transforms data into JSON, handles datetime objects

Parameters:

data – data to transform into JSON

Returns:

A string of formatted JSON