Skip to content

Instantly share code, notes, and snippets.

@howard-haowen
Created January 11, 2021 04:00
Show Gist options
  • Save howard-haowen/b28c9dc3359cd03ce5cb1364a7e6303c to your computer and use it in GitHub Desktop.
Save howard-haowen/b28c9dc3359cd03ce5cb1364a7e6303c to your computer and use it in GitHub Desktop.
Load json files to pandas dataframes
import pandas as pd
import json
def create_df(file_path):
# read the JSON data using json.load()
with open(file_path) as json_file:
data_dict = json.load(json_file)
# convert json dataset from dictionary to dataframe
df = pd.DataFrame.from_dict(data_dict)
return df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment