utils.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:fitbit-analyzer 作者: 5agado 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号