I downloaded the location history json from google maps data and wanted to put all the available content into a pandas dataframe.
df['locations'][5] yields the following:
{'timestampMs': '1540084102574',
'latitudeE7': 327160442,
'longitudeE7': -1171687098,
'accuracy': 17,
'altitude': -13,
'verticalAccuracy': 3,
'activity': [{'timestampMs': '1540083982124',
'activity': [{'type': 'STILL', 'confidence': 100}]}]}
I'm able to map the timestampMs, latitude, and longitude with no problem using:
df['lat'] = df['locations'].map(lambda x: x['latitudeE7'])/10.**7
df['long'] = df['locations'].map(lambda x: x['longitudeE7'])/10.**7
df['ts_ms'] = df['locations'].map(lambda x: x['timestampMs']).astype(float)/1000
but cannot do that for altitude or vertical accuracy as it returns a "KeyError"
Also within the activity there is a nested structure. How would I map those to the data frame as well?