Skip to content

Instantly share code, notes, and snippets.

@justinr922
Last active November 8, 2019 20:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justinr922/2d3f71863e7fc634e2a8bda3e9d6b12e to your computer and use it in GitHub Desktop.
Save justinr922/2d3f71863e7fc634e2a8bda3e9d6b12e to your computer and use it in GitHub Desktop.
Reads in location data from Facebook location_history.json
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