OpenHumans / ohjh-example-notebooks

Explore your personal data with https://notebooks.openhumans.org
http://openhumansfoundation.org/ohjh-example-notebooks/
MIT License
22 stars 10 forks source link

Compare fitbit healthkit error #26

Closed jacobrosenthal closed 6 years ago

jacobrosenthal commented 6 years ago
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
<ipython-input-13-c4df0c1d181c> in <module>()
     11 fitbit_df.index = fitbit_df["date"]
     12 
---> 13 fitbit_df = fitbit_df.groupby(fitbit_df.index.date).sum()
     14 fitbit_df.index = pd.to_datetime(fitbit_df.index)
     15 fitbit_dfr = fitbit_df.rolling('60d').mean()

AttributeError: 'Float64Index' object has no attribute 'date'

Some printout

dates []
steps []
fitbit {'activities-overview': {'best': {'total': {'distance': {'date': '2017-12-10', 'value': 16.01565}, 'steps': {'date': '2017-12-10', 'value': 21101}}, 'tracker': {'distance': {'date': '2017-12-10', 'value': 16.01565}, 'steps': {'date': '2017-12-10', 'value': 21101}}}, 'lifetime': {'total': {'activeScore': -1, 'caloriesOut': -1, 'distance': 753.85, 'steps': 992446}, 'tracker': {'activeScore': -1, 'caloriesOut': -1, 'distance': 741.07, 'steps': 975599}}}, 'heart': {}, 'tracker-activity-calories': {}, 'tracker-calories': {}, 'tracker-distance': {}, 'tracker-elevation': {}, 'tracker-floors': {}, 'tracker-minutes-fairly-active': {}, 'tracker-minutes-lightly-active': {}, 'tracker-minutes-sedentary': {}, 'tracker-minutes-very-active': {}, 'tracker-steps': {}, 'weight-log': {}, 'weight': {}, 'sleep-awakenings': {}, 'sleep-efficiency': {}, 'sleep-minutes-after-wakeup': {}, 'sleep-minutes': {}, 'awake-minutes': {}, 'minutes-to-sleep': {}, 'sleep-start-time': {}, 'time-in-bed': {}, 'profile': {'averageDailySteps': 0, 'encodedId': '223ZBJ', 'height': 182.9, 'memberSince': '2011-02-16', 'strideLengthRunning': 107.80000000000001, 'strideLengthWalking': 75.9, 'weight': 89.2}}
fitbit['tracker-steps'] {}
jacobrosenthal commented 6 years ago

This was due to missing fitbit data. Fixed with a resync after https://github.com/OpenHumans/oh-fitbit-integration/pull/14