Module 1, Practical 10¶
Part 1¶
Some years ago, researchers collected a dataset called “Copenhagen Network study”. They collected several informations among 700 universitary students. In this exam, we are intrested in:
the network of phone calls calls.csv
the network of text messages sms.csv
Information about Facebook friendships fb_friends.csv
The gender of the students genders.csv
the data are like follows: calls.csv
timestamp,caller,callee,duration
184,300,301,121
3920,512,299,670
sms.csv
timestamp,sender,recipient
18,370,512
37,512,370
fb_friends.csv
# user_a,user_b
0,512
0,263
0,525
gender.csv
# user,female
0,0
2,0
3,0
4,0
5,0
you have to write a program that computes the following:
Search for the call with the longest duration.
Are the caller and the callee friend on Facebook?
print the gender of the students belonging to the longest call
how many messages did they exchanged?
Serach for the total number of messages exchanged by pearson that are not friends on FB
NOTE you should define a function for each point.
Show/Hide Solution
Part 2¶
make the dataframe calls and sms shorter. Create a new dataframe containing the first 500 entries of CALLS data, and a new dataframe containing the first 5000 entries of SMS data.
Interactions are given in seconds, you have to discretize them! Each interactions appening in 1 houar have to be discretized into 1. for instance input SMS
time id_a id_b
[
[ 18, 370, 512],
[ 37, 512, 370],
[ 126, 370, 512],
[ 134, 0, 512],
...,
[3549, 512, 299],
[3581, 299, 512],
[3629, 0, 512],
[3918, 512, 299],
...,
]
output SMS
time id_a id_b
[
[ 0, 370, 512],
[ 0, 512, 370],
[ 0, 370, 512],
[ 0, 0, 512],
...,
[ 1, 512, 299],
[ 1, 299, 512],
[ 1, 0, 512],
[ 1, 512, 299],
...,
]
then plot those interactions, you should obtain a plot like the one bellow! pay attention to x and y labels
Show/Hide Solution