In [4]:
# Import libraries
import pandas as pd
%matplotlib inline
In [6]:
# Read local CSV
df = pd.read_csv('usage.csv')
# Describe the dataset
df.describe()
Out[6]:
This already learns me something useful, I've been using my phone for 70 minutes on average each day... That's a lot of time spend on a mobile device... On average I would pick it up for 41 times a day, meaning the average duration of my phone use is about 1,7 minutes per session.
Let's find out!
In [7]:
df.hist()
Out[7]:
In [30]:
# Read local CSV file
df = pd.read_csv('pickups.csv')
# Describe the dataset
df.describe()
Out[30]:
Mmh, it looks like there are some pickups where the length in seconds is rather great, let's remove them. Also note, I picked up my phone over 11530 times. Woah, that's a lot of wear!
In [38]:
# Filter out values over 10 minutes (600 seconds)
df = df[df['seconds'] < 600]
# Show histogram of usage ()
df.hist(bins=100)
Out[38]:
In [73]:
# Create a additional column to save hour
df['hour'] = pd.to_datetime(df['date']).map( lambda x: x.hour )
# Plot histogram of hours
df.hist(['hour'], bins=24)
Out[73]:
As it turns out, phone usage is the highest durign lunch break. There's also a dent in the usage around 19:00 hours, meaning I don't use my phone that often during and after dinner. How about weekdays, could they differ? On we go again:
In [74]:
# Create a additional column to save the weekday
df['weekday'] = pd.to_datetime(df['date']).map( lambda x: x.isoweekday() )
# Then plot
df.hist(['weekday'], bins=7)
Out[74]:
Sunday is my best day! The peak on wednesday is also very interesting! Mmh...