Hi Xinyu,
The Materials API (which MPDataRetrieval is based on) only returns a pointer to the band structure object, see:
https://github.com/materialsproject/mapidoc/tree/master/materials/band_structure
You can get it to work using code like the following:
from matminer.data_retrieval.retrieve_MP import MPDataRetrieval
from matminer.featurizers.bandstructure import BandFeaturizer
from pymatgen import MPRester
df_mp1 = MPDataRetrieval().get_dataframe(criteria='Li2O',
properties=['formula'])
mpr = MPRester()
df_mp1["band_structure"] = df_mp1.index.map(
lambda x: mpr.get_bandstructure_by_material_id(x))
df_mp1 = BandFeaturizer().featurize_dataframe(df_mp1, col_id='band_structure')
print(df_mp1)
I can add an issue to matminer to make this kind of thing easier in the future. Thanks for the report!
···
Best,
Anubhav