From 84adc9fab4d550744f873454cd8def70ca160174 Mon Sep 17 00:00:00 2001 From: ardunn Date: Fri, 11 Oct 2019 15:44:54 -0700 Subject: [PATCH] fix #226 --- automatminer/featurization/core.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/automatminer/featurization/core.py b/automatminer/featurization/core.py index 9789d383..a2b83dfb 100644 --- a/automatminer/featurization/core.py +++ b/automatminer/featurization/core.py @@ -11,6 +11,7 @@ StructureToComposition, StructureToOxidStructure, \ CompositionToOxidComposition from matminer.featurizers.function import FunctionFeaturizer +from matminer.utils.io import store_dataframe_as_json, load_dataframe_from_json from automatminer.utils.log import log_progress, AMM_LOG_FIT_STR, \ AMM_LOG_TRANSFORM_STR @@ -335,7 +336,7 @@ def transform(self, df, target): if self.cache_src and os.path.exists(self.cache_src): self.logger.debug(self._log_prefix + "Reading cache_src {}".format(self.cache_src)) - cached_df = pd.read_json(self.cache_src) + cached_df = load_dataframe_from_json(self.cache_src) if not all([loc in cached_df.index for loc in df.index]): raise AutomatminerError("Feature cache does not contain all " "entries (by DataFrame index) needed " @@ -423,7 +424,7 @@ def transform(self, df, target): multiindex=self.multiindex, inplace=False) if self.cache_src and not os.path.exists(self.cache_src): - df.to_json(self.cache_src) + store_dataframe_as_json(df, self.cache_src) return df def _prescreen_df(self, df, inplace=True):