Disclaimer: This is not medical advice. And please don't be like me. Fasting can be dangerous to some people and if you ever want to try it - please consult your doctor before doing so.

I've come across my biology professor at my school, who was currently on his 13-th day of fast. At first, I didn't believe him. He looked full of energy, had a sharp mind, and wasn't at all hungry (according to him). Everything was opposite of what you expect someone to be after skipping 13 days in a row on every form of calorie intake. I've researched the biology behind fasting and how our bodies respond to it. Many practitioners report increased well-being and mental focus during prolonged fasting. Long story short - I wanted to give it a try. I wanted to collect as much data as possible during my fast. I had my apple watch on me all day, except for bedtime when it needed to be recharged. I bought affordable smart weights from Renpho. They measure many different biological metrics. However, not all of them are within acceptable accuracy (>95%) compared to industrial solutions that can be found in hospitals. Further, I should have measured blood glucose levels as well as blood ketone levels. Since I didn't want to deal with blood then, I decided to pass on that. The best thing about Renpho smart weights is that it synchronizes with Apple Health. Thus I could combine data from both Apple Watch and Repho weights conveniently.

Importing libraries. xmltodict is one of the most powerful libraries to parse XML files.

As all of our fields are of type object (string) we need to change our dates to datetime64.

We will need to pull up Health data separately, so let's create couple of functions. val_to_numeric - changes string object type to numeric getFastData - gets all the data within time I've been fasting transformFastDataAvg - will combine previous functions, group it by creation day and return resampled mean values. We can use mean values on weight, heart-rate and etc, while values like calories spent over the day will need a separate function - transformFastDataSum

As we see, value type is object, thus we need to use our transformFastDataAvg and add it to newly created groupedData series.

Now we need to change Panda's series to dataframe so that we can use awesome df functions

We can see that our "value" field has average weight values for 9 days of fast. Value doesn't look informative, let's rename the column

Not let's add other important metrics to groupedData

We can observe one null value for April 9-th, I just forgot to wear my Apple Watch that day =(

I was also collecting very unscientific happiness index of my wellbeing during 9 days of fast, let's add it to our groupedData.

As creationDate is the index in our dataframe, let's create a separate date column and trim it to just month and day

Once all data is in place we can plot couple of graphs to see results.

We can see that weight was going down, however, it did so with a different pace. It's mostly due to water retention. It's normal as with no nutritial supply the balance of sodium and potassium be corrupted and will lead to water retention in blood cells.

Lean bodymass decreased as well, thus some muscles were burned as well. So let's add a column that will only have amount of fat burned.

In this graph that we can see that rate of burned fat is more gradual compared to weight loss.

From resting heart rate graph we can see that it was increasing all the way until deep ketosis (process of changing main energy fuel from glucose to ketones) was reached. After that it stabilized.

Happiness index is more questionable. First 3 days I was gradually feeling worse. That includes mental and physical wellbeing, energy levels and etc. With reaching ketosis state I started feeling much better. However, after 7 days I started feeling worse. I attribute it to electrolytes imbalance, which effects blood preassure the most. Thus, any movements led to headaches.

To sum everything up it was an interesting experience with some pros and cons. Pros were: training will power, having some great mental experiences. Cons: low energy for first couple of days, feeling pretty bad at the end. However, should I have more free time and extensive preparation I could have controlled by electrolytes balance better, thus delaying processes I've experienced last 2 days of my fast.