Using the app to track my daily habits (sleep, screen time & mood)

A small series of partial projects where I actually try Build something With Numpy instead of just passing functions and random scripts. I have always felt that the best way to learn is by doing, so for this project, I wanted to create something practical and personal.
The idea was simple: Analyze my daily habits – sleep, screen hours, screen time, exercise, and emotions – and see how they affect my productivity and my well-being. The details are not real; It is an invention, made over 30 days. But the goal isn't the accuracy of the details – it's learning to use the information meaningfully.
So let's go through the process step by step.
Step 1 – Upload and understand the details
I started by creating a simple nunpy array containing 30 rows (one for each day) and six columns – each column representing a standard metric. Then I saved as .npy File so I can upload later.
# TODO: Import NumPy and load the .npy data file
import numpy as np
data = np.load(‘activity_data.npy’)
Once loaded, I wanted to make sure everything looked as expected. So I checked type (Knowing how many rows and columns there were) and number of dimensions (To make sure it's a 2D table, not a 1D array).
# TODO: Print array shape, first few rows, etc.
data.shape
data.ndim
Output: 30 rows, 6 columns, and NDIM = 2
I reprinted the first few lines to make sure that each value looked good – for example, that the hours of sleep were not bad or that the values of spirits were within the correct range.
# TODO: Top 5 rows
data[:5]
Output:
array([[ 1. , 6.5, 5. , 4.2, 20. , 6. ],
[ 2. , 7.2, 6. , 3.1, 35. , 7. ],
[ 3. , 5.8, 4. , 5.5, 0. , 5. ],
[ 4. , 8. , 7. , 2.5, 30. , 8. ],
[ 5. , 6. , 5. , 4.8, 10. , 6. ]])
Step 2 – Data validation
Before doing any analysis, I wanted to make sure the data was generated. It's something we often skip when working with artificial data, but it still works well.
So I checked:
- There are no bad hours of sleep
- There are no mood scores below 1 or above 10
For sleep, that meant selecting the sleep column (index 1 on my arrow) and checking for any values below zero.
# Make sure values are reasonable (no negative sleep)
data[:, 1] < 0
Output:
array([False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False, False, False, False, False, False, False, False,
False, False, False])
This means carelessness. After that I did the same with the situation. I calculated to find out if the mood column was at index 5, and checked if there was anything less than 1 or more than 10.
# Is mood out of range?
data[:, 5] < 1
data[:, 5] > 10
We got the same result.
Everything looked good, so we could continue.
Step 3 – Splitting the data into weeks
I had 30 days of data, and I wanted to analyze it week by week. The first idea was to use nunpy's split() work, but that failed because 30 is not divisible by 4. So instead, I used np.array_split()which allows for uneven separation.
That gave me:
- Week 1 → 8 days
- Week 2 → 8 days
- Week 3 → 7 days
- Week 4 → 7 days
# TODO: Slice data into week 1, week 2, week 3, week 4
weekly_data = np.array_split(data, 4)
weekly_data
Output:
[array([[ 1. , 6.5, 5. , 4.2, 20. , 6. ],
[ 2. , 7.2, 6. , 3.1, 35. , 7. ],
[ 3. , 5.8, 4. , 5.5, 0. , 5. ],
[ 4. , 8. , 7. , 2.5, 30. , 8. ],
[ 5. , 6. , 5. , 4.8, 10. , 6. ],
[ 6. , 7.5, 6. , 3.3, 25. , 7. ],
[ 7. , 8.2, 3. , 6.1, 40. , 7. ],
[ 8. , 6.3, 4. , 5. , 15. , 6. ]]),
array([[ 9. , 7. , 6. , 3.2, 30. , 7. ],
[10. , 5.5, 3. , 6.8, 0. , 5. ],
[11. , 7.8, 7. , 2.9, 25. , 8. ],
[12. , 6.1, 5. , 4.5, 15. , 6. ],
[13. , 7.4, 6. , 3.7, 30. , 7. ],
[14. , 8.1, 2. , 6.5, 50. , 7. ],
[15. , 6.6, 5. , 4.1, 20. , 6. ],
[16. , 7.3, 6. , 3.4, 35. , 7. ]]),
array([[17. , 5.9, 4. , 5.6, 5. , 5. ],
[18. , 8.3, 7. , 2.6, 30. , 8. ],
[19. , 6.2, 5. , 4.3, 10. , 6. ],
[20. , 7.6, 6. , 3.1, 25. , 7. ],
[21. , 8.4, 3. , 6.3, 40. , 7. ],
[22. , 6.4, 4. , 5.1, 15. , 6. ],
[23. , 7.1, 6. , 3.3, 30. , 7. ]]),
array([[24. , 5.7, 3. , 6.7, 0. , 5. ],
[25. , 7.9, 7. , 2.8, 25. , 8. ],
[26. , 6.2, 5. , 4.4, 15. , 6. ],
[27. , 7.5, 6. , 3.5, 30. , 7. ],
[28. , 8. , 2. , 6.4, 50. , 7. ],
[29. , 6.5, 5. , 4.2, 20. , 6. ],
[30. , 7.4, 6. , 3.6, 35. , 7. ]])]
Now the data was four chunks, and I could easily analyze each one separately.
Step 4 – Calculating weekly metrics
I wanted to get a sense of how each practice changed from week to week. So I focused on four main things:
- Intermediate sleep
- Study hours are average
- Screen time
- Average winds
I saved an array for each week in a different variable, and then it was used np.mean() to calculate the measurements of each metric.
Average sleep hours
# store into variables
week_1 = weekly_data[0]
week_2 = weekly_data[1]
week_3 = weekly_data[2]
week_4 = weekly_data[3]
# TODO: Compute average sleep
week1_avg_sleep = np.mean(week_1[:, 1])
week2_avg_sleep = np.mean(week_2[:, 1])
week3_avg_sleep = np.mean(week_3[:, 1])
week4_avg_sleep = np.mean(week_4[:, 1])
Study hours are average
# TODO: Compute average study hours
week1_avg_study = np.mean(week_1[:, 2])
week2_avg_study = np.mean(week_2[:, 2])
week3_avg_study = np.mean(week_3[:, 2])
week4_avg_study = np.mean(week_4[:, 2])
Screen time
# TODO: Compute average screen time
week1_avg_screen = np.mean(week_1[:, 3])
week2_avg_screen = np.mean(week_2[:, 3])
week3_avg_screen = np.mean(week_3[:, 3])
week4_avg_screen = np.mean(week_4[:, 3])
Average winds
# TODO: Compute average mood score
week1_avg_mood = np.mean(week_1[:, 5])
week2_avg_mood = np.mean(week_2[:, 5])
week3_avg_mood = np.mean(week_3[:, 5])
week4_avg_mood = np.mean(week_4[:, 5])
Then, to make everything easier to read, I called the results properly.
# TODO: Display weekly results clearly
print(f”Week 1 — Average sleep: {week1_avg_sleep:.2f} hrs, Study: {week1_avg_study:.2f} hrs, “
f”Screen time: {week1_avg_screen:.2f} hrs, Mood score: {week1_avg_mood:.2f}”)
print(f”Week 2 — Average sleep: {week2_avg_sleep:.2f} hrs, Study: {week2_avg_study:.2f} hrs, “
f”Screen time: {week2_avg_screen:.2f} hrs, Mood score: {week2_avg_mood:.2f}”)
print(f”Week 3 — Average sleep: {week3_avg_sleep:.2f} hrs, Study: {week3_avg_study:.2f} hrs, “
f”Screen time: {week3_avg_screen:.2f} hrs, Mood score: {week3_avg_mood:.2f}”)
print(f”Week 4 — Average sleep: {week4_avg_sleep:.2f} hrs, Study: {week4_avg_study:.2f} hrs, “
f”Screen time: {week4_avg_screen:.2f} hrs, Mood score: {week4_avg_mood:.2f}”)
Output:
Week 1 – Average sleep: 6.94 hrs, Study: 5.00 hrs, Screen time: 4.31 hrs, Mood score: 6.50
Week 2 – Average sleep: 6.97 hrs, Study: 5.00 hrs, Screen time: 4.39 hrs, Mood score: 6.62
Week 3 – Average sleep: 7.13 hrs, Study: 5.00 hrs, Screen time: 4.33 hrs, Mood score: 6.57
Week 4 – Average sleep: 7.03 hrs, Study: 4.86 hrs, Screen time: 4.51 hrs, Mood score: 6.57
Step 5 – Making sense of the results
When I printed out the numbers, some patterns started to emerge.
– Mine hours of sleep They were steady in the first two weeks (about 6.9 hours), but in week three, they jumped to 7.1 hours. That means I 'sleep better' as the month goes on. In the fourth week, it lasted about 7.0 hours.
It's simple Study Hoursit was different. Weeks one and two averaged 5 hours a day, but by week four, it dropped to 4 hours. Basically, I started to get stronger but gradually lost momentum – which, honestly, is felt on the right side.
Then it came Screen time. This one hurt a little. In one week, it was about 4.3 hours a day, and it just kept getting brighter every week. The classic cycle is to produce early, then slowly dial in “scrolling breaks” later in the month.
Finally, there was the state of the heart. My mood score started at about 6.5 in week one, slowly went down to 6.6 in week two, and then went back to that the rest of the time. It didn't go much, but it was interesting to see a small spike during the week – right before my study hours went by and my screen time increased.
To make things interactive, I thought it would be nice to visualize using matplotlib.
Step 6 – Looking for patterns
Now that I had these numbers, I wanted to know by whom my emotions went up a week.
So I compared the churches side by side. The second week had better sleep, higher study hours, and less screen time compared to recent weeks.
That would explain why my spirit points went up there. In the third week, although I slept more, my study hours had started to sink – Maybe I was resting too much but doing nothing, which did not improve my mood as much as possible.
This is what I liked about this job: it's not about physical data, but about how to do it Use uny Exploring patterns, relationships, and microcosms. Even fictional data can tell a story when you look at it the right way.
Step 7 – wrapping up with the next steps
In this little project, I learned a few important things – both about numpy and about structured programming like this.
We started with a raw list of daily routines, learned how to examine its structure and function, divide it into logical chunks (weeks), and then use a simple numpy function to analyze each part.
It's the kind of little project that reminds you that data analysis doesn't always have to be complicated. Sometimes it's about asking simple questions like “How does my time change over time?” or “How much better do I feel?”
If I wanted to take this further (which I probably would), there are so many ways to go:
- Find out the best and the worst days – of increase
- Compare intraday vs real
- Or even create a simple “health” score based on multiple combined habits
But that might be for the next part of the series.
For now, I'm glad that I have to invest in something that feels real and comes back – not just abract artasteract and numbers, but habits and feelings. That's the kind of learning that sticks.
Thanks for reading.
If you follow along with the thread, try to retrieve this with your own fictional data. Even if your numbers are random, the process will teach you how to clean, sort, and analyze the range like a pro.



