from json import load from pandas import json_normalize, DataFrame from app.constants import files def open_json(dataset): with open(files[dataset]) as f: json = load(f) return json def create_dataframe(dataset): json = open_json(dataset) data = json_normalize(data=json["records"]) df = DataFrame.from_dict(data=data) return df