Read Files


How to read json files in a directory to a dataframe?

import pandas as pd
import json, os

# List of json files
files = list(os.listdir(json_dir))[0:400]
df = pd.DataFrame()
for file in files:
    json_path = os.path.join(json_dir, file)

    # Load json files
    with open(json_path) as json_file:
        json_data = json.load(json_file)

    # Convert to dataframe     
    json_data_df = pd.io.json.json_normalize(json_data)
    df = df.append(json_data_df)