17 lines
372 B
Python
17 lines
372 B
Python
from json import load
|
|
from pandas import read_json, json_normalize, DataFrame
|
|
from 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
|