Add OxidationStates Featurizer to df

Hello all,

I am new to this forum.

I was wondering how I could add oxidation states to my pandas data frame through matminer? I understand that I need to add oxidation states based on the composition and structure modules, but is there an example of how I could do this?

Thanks

Hi.
You can add oxidation as a separate column via

from matminer.featurizers.conversions import CompositionToOxidComposition
df = CompositionToOxidComposition().featurize_dataframe(df, "composition")

where “composition” is the df-column containing the composition.
However, some of Matminer featurerizers require oxidation within the “structure”, this can be added via

from matminer.featurizers.conversions import StructureToOxidStructure
df = StructureToOxidStructure().featurize_dataframe(df, "structure")

where “structure” is the df-column containing the crystal structure in pymatgen format.