In [67]:
%matplotlib inline

import numpy as np
import pandas as pd
from scipy import stats, integrate
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(color_codes=True)
import pandas as pd
import json
from pandas.io.json import json_normalize

In [78]:
alldata = pd.read_json('./data/MDData.db.json')
dt = pd.DataFrame(alldata['MDData.db']['dailyActivityLog'], columns = ['Id','steps', 'calories', 'recordedForDate'])
mt = pd.DataFrame( alldata['MDData.db']['minutelyActivityLog'], columns = ['Id', 'steps', 'calories', 'recordedForDate'])
dt['Id'] = dt['Id'].astype('int64')
dt['steps'] = dt['steps'].astype('int64')
dt['recordedForDate'] = dt['recordedForDate'].astype('int32')
dt['recordedForDateHR'] = pd.to_datetime(dt['recordedForDate'], unit='s')
dt = dt.sort_values(['Id'], ascending=[False])

mt['Id'] = mt['Id'].astype('int64')
mt['steps'] = mt['steps'].astype('int64')
mt['recordedForDate'] = mt['recordedForDate'].astype('int32')
mt['recordedForDateHR'] = pd.to_datetime(mt['recordedForDate'], unit='s')
mt = mt.sort_values(['Id'], ascending=[False])

In [75]:
dt


Out[75]:
      Id  steps   calories  recordedForDate   recordedForDateHR
368  369      1        0.0       1520485200 2018-03-08 05:00:00
367  368   2543  1316.0043       1520429789 2018-03-07 13:36:29
366  367   4046  110.42745       1520398800 2018-03-07 05:00:00
365  366   2705  112.65048       1520388126 2018-03-07 02:02:06
364  365    984  1678.5878       1520344406 2018-03-06 13:53:26
363  364     12  3.4724085       1520344166 2018-03-06 13:49:26
362  363   6357  175.56093       1520312400 2018-03-06 05:00:00
361  362   3382  2346.4849       1520269614 2018-03-05 17:06:54
360  361    753   24.38462       1520226000 2018-03-05 05:00:00
359  360   5023   855.7403       1520208655 2018-03-05 00:10:55
..   ...    ...        ...              ...                 ...
9     10   9681  274.14722       1496203200 2017-05-31 04:00:00
8      9   8886  246.18927       1496116800 2017-05-30 04:00:00
7      8      0      212.0       1496073960 2017-05-29 16:06:00
6      7   3357  100.89579       1496030400 2017-05-29 04:00:00
5      6   3427  98.609726       1495944000 2017-05-28 04:00:00
4      5   6514  182.63763       1495857600 2017-05-27 04:00:00
3      4  13239   354.5106       1495771200 2017-05-26 04:00:00
2      3   6416  176.66693       1495684800 2017-05-25 04:00:00
1      2      0      211.0       1495655040 2017-05-24 19:44:00
0      1   3014    84.4933       1495598400 2017-05-24 04:00:00

[369 rows x 5 columns]

In [ ]:


In [ ]: