Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
ardunn committed Oct 11, 2019
1 parent c3fdf92 commit 84adc9f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions automatminer/featurization/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 "
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 84adc9f

Please sign in to comment.