I have a df:
Date Time
06/20/20 1740
02/19/20 1600
09/22/20 1530
12/09/20 1326
06/12/19 1119
07/19/19 1703
08/02/20 1805
12/05/19 0932
11/09/20 1134
01/14/20 1634
The times are listed in military time. I would like to create a data frame that has a third variable (working_hours) that is a binary. If the date is a Monday through Friday and the Time is between 0900 and 1700 then I'd like a 1, otherwise 0. I'd also like to make a variable, Morning, for if the time is before or after noon (1200). Any thoughts?
Output:
Date Time Working_Hours Morning
06/20/20 1740 0 0
02/19/20 1600 1 0
09/22/20 1530 1 0
12/09/20 1326 1 0
06/12/19 1119 1 1
07/19/19 1703 0 0
08/02/20 1805 0 0
12/07/19 0932 0 1
11/09/20 1134 1 1
01/12/20 1634 0 0
Aucun commentaire:
Enregistrer un commentaire