Skip to content

How can I create MODData with my DataFrame? #63

Answered by ppdebreuck
mhlee216 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @mhlee216,

You should first extract the structures (list of pymatgen structures or compositions) and targets (2D array) from the CSV file.
Example: you read the csv as a dataframe df with columns "structures" and "e_form".

data = MODData(materials = df["structures"],
               targets = df[["e_form"]].values,
               target_names = ["formation_energy"]
              )

If you already have features you can pass them to the df_featurized keyword. Otherwise use data.featurize().

Finally, you can append other features to the featurized MODData by using join or concat: data.df_featurized = data.df_featurized.join(df_with_my_features). (Features are simply stored as a dataframe at

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mhlee216
Comment options

Answer selected by mhlee216
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants