Spaces:
Runtime error
Runtime error
import requests | |
import zipfile | |
import json | |
import os | |
import pandas as pd | |
# URL of the ZIP file | |
endpoint_url = 'https://figshare.com/ndownloader/files/38521268' | |
dbzip = 'db.zip' # Temporary file name for the downloaded ZIP file | |
dbfile = 'd2-12-12-2022.json' | |
def get_data_from_api(): | |
try: | |
with open(dbfile) as dbf: | |
data2d=json.load(dbf) | |
dbdata =pd.DataFrame(data2d) | |
except: | |
print(dbdata) | |
return dbdata | |
def get_materials_from_api(): | |
return get_data_from_api()['data']['compounds'] | |
def get_properties_from_api(): | |
return list(get_data_from_api().columns) | |
for p in get_properties_from_api(): | |
print(p) |