6 Kgs Lost in 31 Days of COVID-19 Lockdown: A Data Analytics Perspective

Herman Wandabwa
The Startup
Published in
9 min readMay 12, 2020

New Zealand lockdown has eased to alert Level 2 starting midnight on Wednesday 13th May 2020. This has given me some time to narrate a data story of how I fared especially at security alert Level 4 where literally the entire country was shut. Three things I promised to work on during this time :-

1. Finish up one cloud data engineering certification. I’m proud to say I completed the Google Data Engineering certification. 6 courses with lots of practicals and connected fundamentals between them. Needs time but I’m proud to have achieved this specialization. My accomplishment is here. Please connect on Linkedln too. By the way, the course was free at the time for 30 days or so. Piece of advise, register, finish up the course and cancel the subscription. Any time spent above the 30 days may lead to a charge.
2. Lose weight. Yes, you read it right. Fortunately, there was never a ban on outdoor exercising as long as one was doing it with care and love. This meant distancing and washing hands after exercising. I personally exercised outdoors and kept at least a 4 metre gap with the next person. I was determined to shed off about 5 kgs in that month.
3. Finishing up on some NLP related research. Lets leave this point at that as I don’t remember touching on this.

I’m keen on telling the data story about number 2 just like I have done on other topics; my weight loss journey. Luckily, I own a Fitbit Versa thus data collection at this time wasn’t an issue. I recorded all the food I consumed, while it automatically recorded my activity and sleeping patterns. I was determined to hack this once and for all.

Data Collection

Fitbit internal data organization framework is quite structured thus made it very easy to collect it via its dashboard. The dashboard welcome screen should be something close to the below.

Fitbit Dashboard

To collect data, click on the settings down arrow, and Versa as shown below. Versa is my Fitbit device version. The name should match the device version that you have. Alternatively, one has the option of getting larger archives of their lifetime data.

I chose custom dates as shown below and downloaded data related to body, foods, activities and sleeping patterns in CSV format. This is what I analyzed further.

Data download

Data Ingestion

A sample of the downloaded data is shown below. I collected data for 31 days thus had 31 records of mainly activity and sleep data. This was ingested as a dataframe in Python. Its always easier to do it that way.

A little bit of Sanitization

I needed more factors to look at in the analysis. For example, based on the date field, I could easily come up with the exact day of the week that was and assign a day code it. Instead of day 0, I needed Mon for Monday to be in the output. This is great especially for visualizations. Luckily, Pandas has heaps of internal functions to help achieve lots of tasks faster. In my case, the below code was enough.

It then became easier to look at statistics or influence of varied factors over other variables. For example, it would be much easier to decipher my sleeping habits say over the weekend as compared to weekdays. All I needed in such cases was to group the entire dataset and get the average of each variable by say the day of the week or whether the day was weekend or weekday as below:-

From the summaries in the notebook shared at the bottom, I realized that I ate less calories and burned more over weekends than weekdays. I also slept longer and woke up many times at night over weekdays than weekends. Probably dreading work in the mornings or just the simple fact that all odds are against weekdays. They are more than weekends so seem statistically significant. On the other hand, Fridays seemed to be my lazy days during lockdown. Realistically, I had/still have most of my meetings on this day. I also rarely exercised on Fridays too as I prepared for sabbath the following day. Results make sense to this stage.

Movement Analysis (Steps, Distance covered, Calories and Floor counts)

As mentioned earlier, exercising was one of the permitted activities during lockdown as long as it was done safely. I mostly went running, a little walking and cardio exercises. A summary of my movement data shows that I burned 3122 calories on average while my mean active time remained at 63 minutes. That’s quite impressive as most people keep it at 40. The below graphs corroborate my earlier assumption about Fridays. Its the day I burned less number of calories, didn’t move much and sat longer, with the look of sedentary minutes.

Day of the Week vs Steps, Calories Burned and Sedentary Minutes

The conclusions above are in line with the statistics in the below graphs regarding movement. Tuesdays and Saturdays were the days I exercised hardest.

Day of the Week vs Active Minutes, Activity Calories and Floors

Calories Burned vs Other Factors

There are several factors that catalyze calories burned. In short, there is a positive correlation between calories burned and those factors. To find this out, I had to plot the below heatmap to depict this correlation. As expected, Calories burned and Steps correlate to a very high degree i.e. 0.97 as well as with Minutes Very Active at 0.89. Remember 1 is the highest correlation coefficient in this case. Minutes sedentary in my case is the most negatively correlated factor to calories burned. Its simple, you don’t move, you don’t burn any calories.

Correlation between Calories burned and other activity factors

Weight vs Other Factors

I also visualized factors that influenced the change in weight during the 31 days in the below heatmap. Calories burned is still key in losing/gaining weight. Steps, Minutes Fairly Active and Minutes Very Active were also significant in the loss of weight in my case. Sleep related data depicted a negative correlation to weight loss. I couldn’t simply “sleep off” my weight. I had to exercise.

Sleep Analysis

As per this article https://help.fitbit.com/articles/en_US/Help_article/2163, Fitbit devices with heart-rate tracking (except Fitbit Charge HR or Fitbit Surge) can be used to track sleeping habits categorized in sleep stages. When one is asleep, the body typically goes through sleep cycles that last about 90 minutes on average. The cycles alternate between light and deep sleep. Sleep stages are defined as below:-

  1. Light SleepThis serves as the entry point into sleep each night as your body unwinds and slows down. This stage typically begins within minutes of falling asleep. During the early part of light sleep, one may drift between being awake and asleep.
  2. Deep Sleep -Deep sleep typically occurs in the first few hours of sleep. When you wake up feeling refreshed in the morning, you’re likely to have experienced solid periods of deep sleep during the previous night.
  3. Rapid Eye Movement(REM) Sleep -The first phase of REM sleep typically occurs after you’ve had an initial stage of deep sleep. You generally stay in REM sleep for a longer period of time during sleep cycles occurring in the second half of the night. During this final stage of sleep, your brain becomes more active. Dreams mainly occur during REM sleep, and your eyes move quickly in different directions. Heart rate increases and breathing becomes more irregular. In principle, muscles below the neck are inactive to avoid acting out dreams.

To better analyse sleep data, I had to select a subset of the main dataset that directly related with sleep. I chose Date,Minutes Asleep,Minutes Awake,Number of Awakenings,Time in Bed,Minutes REM Sleep,Minutes Light Sleep, Minutes Deep Sleep,Day_of_week and Is Weekend variables.

Sleep Data

From the two plots above, I spent about 7 hours in bed most of the days. I worked online thus woke up at about 8AM but slept close to midnight. Roughly, that averaged to about 7 hours. The recommended sleep hours by National Sleep Foundation are 7–9 hours per night for adults.

On the other hand, half of my sleep was categorized as Light Sleep at 50.7% followed by deep sleep at 19.5%. Apparently, I was awake 14.9% of my sleep time during this period as shown in the pie-chart below.

Amount of Sleep vs Sleep Stages

The findings in the above pie-chart, led me to further probe whether time taken in bed influenced the sleep stages. From the correlation graph below, good sleep (deep sleep) did not correlate to a very high level with time taken in bed. This means that I didn’t need to be in bed for long to get good sleep. I still need to figure out my triggers for deep sleep. I probably need to take some type of tea for better sleep? I still don’t know.

Time in Bed vs Other Sleep Factors

Did I sleep better on Specific Days during the lockdown period?

On average, I slept almost the same across the days over the month except for Saturday. I didn’t “sleep deeply” on this day. The fact that Sunday is an easy day meant that I stayed up very late on Saturdays compared to other days of the week as shown in the below graph. Light sleep was to a lesser extent on Thursdays.

Sleep Stages Across Days of the Week

This Saturday sleep pattern analogy is better illustrated in the variation of sleep duration across the week days as shown below.

Saturday had the highest variance i.e. from as low as about 340 minutes to a high of about 470 minutes. I was very inconsistent in my sleep duration on Saturdays.

Summary of the Weight Loss Journey

I actually wrote all the above to justify the weight I lost over the 31 day period. I correlated several factors across the dataset to find patterns on what I actually need to focus on to exercise, sleep and possibly eat better for weight loss. I can confidently say that I lost about 6.1 Kgs over the time period as shown in the below graph contrary to expectations of many as movement was restricted.

Weight Loss Journey

A few conclusions from the analyses : -

  1. Exercise and Food — Its said that the 80% diet and 20% exercise rule works for most people when it comes to weight loss. I’ll never dispute that. However, I didn’t pay much attention to the diet. Only exception was that all food I ate was home cooked. After all, all takeaways were closed so no options. I also ingested lots of carbs. Rice, chapati and spaghetti were part of my daily food portions.
  2. Sleep Stages — Maximizing the deep sleep stage seems to be of importance. This is one area I need to work on. I still don’t know how. After all, being in bed longer doesn’t equate to good sleep.
  3. It is possible to lose 6Kgs in a month. I thought it was an impossibility, till I was consistent with workouts. On average, I covered 9.912581 kms / 63 minutes per day across the month. This measurement is relative across individuals but for a novice runner, I must have done well.

Thank you for reading. The notebook and dataset can be accessed here. Please connect via Linkedln. I’ll also be glad to respond to you in case of any queries.

--

--