Skip to content

Instantly share code, notes, and snippets.

@northface
Last active June 20, 2017 13:10
Show Gist options
  • Save northface/4bf33e2ea76f6d0fdb39bf090f13ff58 to your computer and use it in GitHub Desktop.
Save northface/4bf33e2ea76f6d0fdb39bf090f13ff58 to your computer and use it in GitHub Desktop.
手元にあったFitbitの心拍データの読み込み
import matplotlib.pyplot as plt
import pandas as pd
import glob
%matplotlib inline
csv_files_hr = glob.glob('HR/*.json')
heart_df = pd.DataFrame()
for f in csv_files_hr:
hr = pd.read_json(f,typ='series')
hr.to_dict()
date = pd.DataFrame.from_dict(hr['activities-heart']).dateTime[0]
temp = pd.DataFrame.from_dict(hr['activities-heart-intraday']['dataset'])
temp.index = pd.to_datetime([date + " " + t for t in temp.time])
heart_df = pd.concat([heart_df,temp])
heart_df.plot(y="value", figsize=(20,5))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment