def loadStepsData(dumpDir):
"""
Load steps data from dumping done using the official Fitbit API.
Check README file for further info on the scraping process and saved format
:param dumpDir: the folder where the date has been dumped
:return: a list of dataframes, one for each day, containing the intraday steps data
"""
def loadFun(jsonData):
intradayData = jsonData['activities-steps-intraday']['dataset']
date = jsonData['activities-steps'][0]['dateTime']
if not intradayData:
return None
df = pd.read_json(json.dumps(intradayData))
df['datetime'] = pd.to_datetime(date + ' ' + df['time'])
df.drop('time', inplace=True, axis=1)
return df
return _loadData(dumpDir, 'steps', loadFun)
评论列表
文章目录