I'm trying to upgrade from the nokia library to start using this one. I have the auth and everything working so far, just wanted to ask the best way to get data from this library into a pandas df... I've started down this route, but feel like there is probably a better way?
client = WithingsApi(withings_creds(current_token_dict()), refresh_cb=save_withings_token)
df = pd.DataFrame(columns=['date_utc', 'weight', 'fat_ratio', 'hydration'])
meas_result = client.measure_get_meas()
for x in meas_result.measuregrps:
date = pd.to_datetime(str(x.date))
weight = get_measure_value(x, with_measure_type=MeasureType.WEIGHT)
fat_ratio = get_measure_value(x, with_measure_type=MeasureType.FAT_RATIO)
hydration = get_measure_value(x, with_measure_type=MeasureType.HYDRATION)
if weight and fat_ratio:
df = df.append({'date_utc': date, 'weight': weight, 'fat_ratio': fat_ratio, 'hydration': hydration},
ignore_index=True)
df = df.set_index(df['date_utc'].apply(lambda x: x.replace(tzinfo=None)))
df = df[['weight', 'fat_ratio', 'hydration']]
# Convert to lbs
df['weight'] *= 2.20462
Hello!
I'm trying to upgrade from the nokia library to start using this one. I have the auth and everything working so far, just wanted to ask the best way to get data from this library into a pandas df... I've started down this route, but feel like there is probably a better way?
Thanks!