Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions dice_ml/diverse_counterfactuals.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import copy
import json
import math
from io import StringIO

import numpy as np
import pandas as pd
Expand Down Expand Up @@ -223,10 +224,10 @@ def to_json(self, serialization_version):
def from_json(cf_example_json_str):
cf_example_dict = json.loads(cf_example_json_str)
if cf_example_dict.get(_DiverseCFV1SchemaConstants.TEST_INSTANCE_DF) is not None:
test_instance_df = pd.read_json(cf_example_dict[
_DiverseCFV1SchemaConstants.TEST_INSTANCE_DF])
test_instance_df = pd.read_json(StringIO(cf_example_dict[
_DiverseCFV1SchemaConstants.TEST_INSTANCE_DF]))
if cf_example_dict[_DiverseCFV1SchemaConstants.FINAL_CFS_DF] is not None:
cfs_df = pd.read_json(cf_example_dict[_DiverseCFV1SchemaConstants.FINAL_CFS_DF])
cfs_df = pd.read_json(StringIO(cf_example_dict[_DiverseCFV1SchemaConstants.FINAL_CFS_DF]))
else:
cfs_df = None

Expand Down