mardi 19 janvier 2021

Pandas - How to fill column with range time conditions

I have a dataset with different columns: the activity description and when it's started and ended

    Activity    Start       End      In time
    Activity 1  10:44:26    15:02:24    
    Activity 2  15:22:42    13:52:54    
    Activity 3  14:41:57    16:03:48    
    Activity 4  11:16:08    13:37:16    
    Activity 5  15:49:39    08:51:18    
    Activity 6  19:36:37    15:19:26    
    Activity 7  14:47:33    19:39:29    
    Activity 8  15:40:52    19:30:26

How can i fill in Pandas the column "In time" with this condition:

  • if Start is > 8AM and End is < 5:30PM is in time else is not in time.

I tried with datetime module, pd.between_time()... I created my own def but it doesn't work.

How can I fix my problem?

Aucun commentaire:

Enregistrer un commentaire