graphPaname/app/preprocessing.py

17 lines
372 B
Python
Raw Normal View History

2020-05-27 20:13:45 +02:00
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