Spaces:
Runtime error
Runtime error
File size: 669 Bytes
1c703f0 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
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) |