Screen time analysis refers to analyzing the amount of time a user spends interacting with their device (such as a smartphone, tablet, or computer) and various applications on a daily, weekly, or monthly basis. So, if you want to learn how to analyze the screen time of a user, this article is for you. In this article, I’ll take you through the task of analyzing the screen time of a user using Python.
Analyzing Screen Time: Getting Started
For the task of analyzing the screen time of a user, we need data about the app usage activity of a user on a particular device. I found an ideal dataset for this task, which contains features like:
- Date: The date on which the data was recorded.
- App: The name of the application being used (e.g., Instagram, WhatsApp).
- Usage (minutes): The total number of minutes spent on the app daily.
- Notifications: The number of notifications received from the app each day.
- Times Opened: The number of times the app was opened on the recorded day.
You can download the dataset from here.
Analyzing Screen Time with Python
Now, let’s get started with the task of analyzing the screen time of a user by importing the necessary Python libraries and the dataset:
import pandas as pd
data = pd.read_csv("/content/screentime_analysis.csv")
data.head()
Let’s have a quick look at the summary statistics before moving forward:
data.describe()

Let’s start by analyzing the screen time trends of all the apps in the data over time:
import matplotlib.pyplot as plt
import seaborn as sns
data['Date'] = pd.to_datetime(data['Date'])
plt.figure(figsize=(12, 6))
sns.lineplot(x='Date', y='Usage (minutes)', hue='App', data=data, marker="o")
plt.title('Screen Time Trends for Different Apps')
plt.ylabel('Usage (minutes)')
plt.xlabel('Date')
plt.xticks(rotation=45)
plt.tight_layout()
plt.show()
The graph illustrates the screen time usage of various apps throughout August 2024. Instagram shows the most fluctuating and high usage, peaking around mid-August and August 26. Apps like X, WhatsApp, and Netflix generally show lower and more consistent usage. Safari and 8 Ball Pool also show significant variability, with 8 Ball Pool reaching its highest point around August 11. LinkedIn and Facebook maintain relatively low and stable usage throughout the period. Overall, Instagram dominates screen time, while other apps experience occasional spikes but lower overall engagement.
Now, let’s have a look at the relationship between the screen time of the user, the number of notifications the user received, and the number of times the user opened any app:
plt.figure(figsize=(8, 6))
pairplot = sns.pairplot(
data[['Usage (minutes)', 'Notifications', 'Times Opened']],
kind="scatter",
diag_kind="kde",
plot_kws={'alpha':0.6, 's':50}
)
pairplot.fig.suptitle('Relationships between Screen Time, Notifications, and Times Opened', y=1.02, fontsize=14)
plt.tight_layout()
plt.show()
The above pair plot shows relationships between screen time (usage in minutes), notifications, and times an app was opened. The scatter plots indicate a moderate positive correlation between notifications and times opened, as well as between times opened and usage minutes, which suggests that more notifications lead to more app usage and openings. However, the correlation between usage and notifications is weaker, showing that receiving many notifications does not always result in higher screen time. The histograms on the diagonal also show that most data points cluster around low values for usage, notifications, and times opened.
Now, let’s analyze the top apps based on screen time and break down the average usage, notifications, and times opened per app. It will give us a clearer picture of user behaviour across apps:
app_analysis = data.groupby('App').agg(
avg_usage=('Usage (minutes)', 'mean'),
avg_notifications=('Notifications', 'mean'),
avg_times_opened=('Times Opened', 'mean')
).reset_index()
app_analysis = app_analysis.sort_values(by='avg_usage', ascending=False)
app_analysis
The table displays the average screen time usage, notifications, and times opened for each app. Here are the key insights:
- Instagram: This app leads in both screen time and notifications, averaging about 76 minutes of usage per day, with 49 notifications and being opened around 41 times.
- WhatsApp: It ranks second in terms of times opened (averaging 68 times), with a very high number of notifications (around 100), though its screen time is lower than Instagram and Netflix.
- Netflix: Users spend significant time on Netflix (72 minutes/day), but it stands out for its low interaction frequency, with only 2.56 app opens and almost no notifications. This reflects the nature of long, continuous usage (e.g., watching shows or movies).
- Other Apps: Apps like Facebook, LinkedIn, and Safari have lower usage and interaction metrics, showing they are used less frequently and for shorter sessions.
Now, let’s have a look at the average screen time of the user by day of the week:
data['Day of Week'] = data['Date'].dt.day_name()
weekly_usage = data.groupby('Day of Week')['Usage (minutes)'].mean().reindex(
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday'])
plt.figure(figsize=(12, 6))
ax = sns.barplot(x=weekly_usage.index, y=weekly_usage.values, palette="crest")
for p in ax.patches:
ax.annotate(format(p.get_height(), '.1f'),
(p.get_x() + p.get_width() / 2., p.get_height()),
ha = 'center', va = 'center',
xytext = (0, 9), textcoords = 'offset points')
plt.title('Average Screen Time Usage per Day of the Week', fontsize=16)
plt.ylabel('Average Usage (minutes)', fontsize=12)
plt.xlabel('Day of the Week', fontsize=12)
plt.xticks(rotation=45, fontsize=10)
plt.yticks(fontsize=10)
plt.tight_layout()
plt.show()
The highest usage occurs on Monday (48.6 minutes) and Wednesday (46.5 minutes), which indicates that the beginning and middle of the week see the most screen time. Usage decreases towards the end of the week, with Friday having the lowest average (27.1 minutes). Screen time increases again on Saturday (41.4 minutes) and slightly drops on Sunday (35.8 minutes). This pattern suggests higher screen engagement during workdays and moderate usage over the weekend.
Now, let’s analyze the daily patterns for the top three apps: Instagram, Netflix, and WhatsApp. It will give us insights into how users engage with these apps throughout the week:
top_apps_data = data[data['App'].isin(['Instagram', 'Netflix', 'WhatsApp'])]
daily_app_usage = top_apps_data.groupby(['App', 'Day of Week'])['Usage (minutes)'].mean().reindex(
pd.MultiIndex.from_product([['Instagram', 'Netflix', 'WhatsApp'],
['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']],
names=['App', 'Day of Week'])).reset_index()
plt.figure(figsize=(12, 6))
ax = sns.barplot(x='Day of Week', y='Usage (minutes)', hue='App', data=daily_app_usage, palette='Set2')
for p in ax.patches:
height = p.get_height()
if height > 0:
ax.annotate(f'{height:.1f}',
(p.get_x() + p.get_width() / 2., height),
ha='center', va='center',
xytext=(0, 8), textcoords='offset points')
plt.title('Average Daily Usage for Instagram, Netflix, and WhatsApp', fontsize=16)
plt.ylabel('Average Usage (minutes)', fontsize=12)
plt.xlabel('Day of the Week', fontsize=12)
plt.xticks(rotation=45, fontsize=10)
plt.yticks(fontsize=10)
plt.legend(title='App', fontsize=10, title_fontsize=12)
plt.tight_layout()
plt.show()
Instagram consistently has the highest usage, especially on Saturday (91.0 minutes) and Wednesday (90.4 minutes). Netflix usage peaks on Wednesday (110.0 minutes) and Saturday (78.8 minutes), which shows strong mid-week and weekend engagement. WhatsApp usage is generally lower than Instagram and Netflix, with its highest usage on Sunday (59.0 minutes) and Wednesday (76.0 minutes). Overall, Wednesday and Saturday are the days with the highest overall screen time across these three apps.
Calculating the Probability of App Openings Through Notifications
Now, we will calculate the probability of the user opening the app from each notification. To calculate the probability of a user opening each app when there is a notification, we can use the following approach:
- Step 1: Calculate the number of instances where there were notifications (Notifications > 0).
- Step 2: Calculate how often the app was opened on those days (Times Opened > 0).
In this scenario, the probability can be calculated as:
P(Open|Notification) = Number of days the app was opened when notifications were received / Total number of days notifications were received
I will calculate this for each app in the dataset:
notifications_data = data[data['Notifications'] > 0]
app_opened_when_notif = notifications_data.groupby('App').apply(
lambda x: (x['Times Opened'] > 0).sum() / len(x)
).reset_index(name='Probability of Open with Notification')
app_opened_when_notif
For all listed apps, including 8 Ball Pool, Facebook, Instagram, LinkedIn, Netflix, Safari, WhatsApp, and X (formerly Twitter), the probability is 1.0, which means that every time a notification is received for any of these apps, the user opens the app. It indicates a strong responsiveness to notifications across all the apps, which suggests that notifications are a highly effective way to prompt user engagement for these applications. Conversely, if the user wants to decrease screen time, the first step should be to turn off the notifications.
Find more examples to improve your Data Analytics skills here.
Summary
So, the screen time analysis reveals that Instagram consistently dominates user engagement, with high usage peaks during the week, particularly on Mondays, Wednesdays, and Saturdays. Netflix also shows strong mid-week and weekend engagement, while WhatsApp remains moderate throughout. Additionally, all apps have a 100% probability of being opened upon receiving a notification, which indicates high user responsiveness to notifications across various apps.
I hope you liked this article on analyzing the screen time of a user with Python. Feel free to ask valuable questions in the comments section below. You can follow me on Instagram for many more resources.





