Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created April 9, 2020 14:23
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 sergiolucero/583e55a19dec25242971ad89c2634f07 to your computer and use it in GitHub Desktop.
Save sergiolucero/583e55a19dec25242971ad89c2634f07 to your computer and use it in GitHub Desktop.
Plotting total travel from my Google Location History
import pandas as pd
import seaborn as sns
import matplotlib.pyplot as plt
df = pd.read_csv('mobility.csv', encoding='latin-1') # this comes from Google Takeout in JSON format
fig, ax = plt.subplots(1, figsize=(24,18))
p = sns.heatmap(df[df.año>2013].pivot_table(index='año', columns='mes', values='distancia'),
annot=True, annot_kws = {'size':14, 'weight': 'bold'}, fmt='.1f', cmap='brg')
_ = p.set_title('Kilómetros recorridos por Sergio Lucero al mes (según Google Maps)', size=24)
plt.savefig('mobility.png', dpi=720)
@sergiolucero
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment