Last active
May 8, 2020 15:54
-
-
Save JoeThunyathep/645989e915a47e46641e7dcc38523ea8 to your computer and use it in GitHub Desktop.
read several JSONs to Dataframe
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import glob, os, json | |
df = pd.DataFrame() | |
path_to_json = 'path_to_your_json_folder' | |
json_pattern = os.path.join(path_to_json,'*.json') | |
file_list = glob.glob(json_pattern) | |
for file in file_list: | |
data = pd.read_json(file, lines=True) | |
df = df.append(data) | |
df = df.set_index('date') | |
#... have fun with your Dataframe ... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment