Fitbit Analysis
Mon Sep 09, 2019 · 422 words

I recently got a fitbit, and have been using it for the past 2 months or so. Curious, I decided to download my fitbit data to explore with. I am an avid believer in learning by doing - which is why I decided to practice my data cleaning and analysis skills with my own fitbit data. With the data, preprocessed the data using pandas and numpy, and plotted it with matplotlib. The goal of this project was to describe the data that has been collected, beyond the scope of the fitbit dashboard.

During this project, 80% of my time was spent cleaning and compling my data into a large dataframe which I could then manipulate. Since I take a lot of naps, I had to differentiate my naps from regular nightly sleep by manipulating my sleep data. Though, my sleep schedule is pretty erratic, so this was a challenge.

nap = []
for n in range(len(dfSleep.index)):
  if dfSleep.startTime[n].hour > 7 and dfSleep.startTime[n].hour < 21 and dfSleep.minutesAsleep[n] <= 300 :
    val = 1
  else:
    val = 0
  nap.append(val)
  
dfSleep['nap'] = nap

Above is the snippet of code where I separated between the 2, though this would vary depending on the time you sleep and the average length of your naps haha.

Steps taken and Average BPM

Furthur my exploration, I looked into the relationship between the total steps taken and my average bpm for the day. My average BPM for the day seems to be postively influenced by the number of steps I took that day.

Average nap duration

Here, I plotted the average time I spend on naps per day. On average, I spend the most time on my naps on Saturdays, and almost half as little time on Mondays. Maybe that explains the dreaded Monday blues.

Average steps

Over the summer, I took on 2 part time jobs, one as a Research Intern and the other as a Data Collation Assistant, one of which requires me to move quite frequently from one place to another. Interestingly, the barchart on my average steps taken quite accurately reflects my weekly work schedule - progress meetings on Wednesdays and the rest of the week I’d have shifts and would be moving around alot.

To sum up, this project, although intended only to satisfy my curiosity, was enjoyable and a great opportunity for a referesher on my python skills. With some preprocessing and data exploration, anyone would be able to find pretty interesting insights on themselves through their fitbit data.

The link to my github repo on this project can be found here. Happy coding!


back · projects · links · Hi, I'm Niki. · home