This week I need to grab a JSON file (from my Mongo database) and put this info in a Dataframe. Pandas makes this supprisingly easy, of course. Here is the code.
import pandas as pd import json with open('./datajson') as data_file: data = json.load(data_file) df = pd.io.json.json_normalize(data) print(df)
We simply load the json file, parse the json with the build in Python json library and then use the
json_normalize to convert the documents. Super easy.