mardi 21 juillet 2020

Identifying individual session in between household session in python

I am trying to write a code where I have got two independent data sets i.e. Household viewing data. if a whole household starts watching something between 2PM to 3PM (mentioned in seconds format). there are five individuals of the same household watched that session but for different duration. i.e.

DATASET1 - HOUSEHOLD DATA

household start_time end_time channel duration_watched
one       50400      54000     A      3600   

DATASET2 - INDIVIDUAL DATA

household   individual   start_time end_time channel duration_watched
one             1          50400      51300     A      900   
one             2          50800      52400     A      1600   
one             3          52400      52900     A      900   
one             4          51000      54000     A      3000   

EXPECTED OUTPUT iS identifying the individual sessions of the household session

DATASET OUTPUT


household   individual   start_time end_time channel duration_watched   IDENTIFICATION
one             1          50400      51300     A      900                HH SESSION
one             2          50800      52400     A      1600               HH SESSION
one             3          52400      52900     A      900                HH SESSION
one             4          51000      54000     A      3000               HH SESSION

I tried with for, it didn't work.

  • I have got many household sessions and individual sessions that has to be identified pertaining to these household sessions.

Thank you.

Aucun commentaire:

Enregistrer un commentaire