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:

  1. the network of phone calls calls.csv

  2. the network of text messages sms.csv

  3. Information about Facebook friendships fb_friends.csv

  4. 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:

  1. Search for the call with the longest duration.

  2. Are the caller and the callee friend on Facebook?

  3. print the gender of the students belonging to the longest call

  4. how many messages did they exchanged?

  5. 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

  1. 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.

  2. 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],
   ...,
]
  1. then plot those interactions, you should obtain a plot like the one bellow! pay attention to x and y labels

nb_interactions

Show/Hide Solution