<reponame>AidanFarhi/PythonFundamentals.Labs.PipModule<gh_stars>0
import json
import pandas as pd
import os


def read_json(file_path):
    file = open(file_path, 'r')
    data = json.load(file)
    file.close()
    return data


def read_all_json_files(JSON_ROOT):
    df = pd.DataFrame()  # create empty data frame
    for file_name in os.listdir(JSON_ROOT):  # iterate through directory
        if file_name.find('daily') == -1:  # check that file has 'locations' in it
            continue
        file_path = 'data/daily_summaries/' + file_name  # create full path to pass to read_json function
        data = read_json(file_path)  # get data from file
        df = df.append(data['results'])  # append data to DataFrame
    return df

import json
import pandas as pd
import os


def read_json(file_path):
    file = open(file_path, 'r')
    data = json.load(file)
    file.close()
    return data


def read_all_json_files(JSON_ROOT):
    df = pd.DataFrame()  # create empty data frame
    for file_name in os.listdir(JSON_ROOT):  # iterate through directory
        if file_name.find('daily') == -1:  # check that file has 'locations' in it
            continue
        file_path = 'data/daily_summaries/' + file_name  # create full path to pass to read_json function
        data = read_json(file_path)  # get data from file
        df = df.append(data['results'])  # append data to DataFrame
    return df
# create empty data frame # iterate through directory # check that file has 'locations' in it # create full path to pass to read_json function # get data from file # append data to DataFrame