Last active
November 8, 2019 20:36
-
-
Save justinr922/2d3f71863e7fc634e2a8bda3e9d6b12e to your computer and use it in GitHub Desktop.
Reads in location data from Facebook location_history.json
This file contains 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 #for creating/managing dataframes | |
import json as json #for reading Facebook's JSON files | |
def read_json(path_to_json): | |
# Opens the json file in memory | |
with open(path_to_json, 'r', encoding='utf8') as file: | |
# Reads the file into a string, and then uses jsons.loads (loadstring) | |
# to interpret the data | |
data_file = json.loads(file.read()) | |
return pd.DataFrame(data_file['location_history']) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment