Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
logger.info(
self._log_prefix + "Compositions detected as dicts. Attempting "
"conversion to Composition objects..."
)
df[featurizer_type] = [
Composition.from_dict(d) for d in df[featurizer_type]
]
# Convert non-oxidstate containing comps to oxidstate comps
if self.guess_oxistates:
logger.info(
self._log_prefix
+ "Guessing oxidation states of compositions, as"
" they were not present in input."
)
cto = CompositionToOxidComposition(
target_col_id=featurizer_type,
overwrite_data=True,
return_original_on_error=True,
max_sites=-50,
)
cto.set_n_jobs(self.n_jobs)
try:
df = cto.featurize_dataframe(
df,
featurizer_type,
multiindex=self.multiindex,
inplace=False,
)
except Exception as e:
logger.warning(
self._log_prefix + "Could not decorate oxidation states due "