I am working with those two dataframes. df1 is a list of potential shift that the person can do. And df2 is a basically his/her schedule when he/she is available.
Starts_at is the begining of the shift/availability ; Ends_at is the end of the shift/availability
I would like to to remove all the potential shift that the person cannot do because of the schedule. Like for example you can see that this person is not available on the morning so I should remove 0 and 3 index in n1
I started doing something like that df1[df1.starts_at[0] >= df2.starts_at]
but it is not working
n1 = {'starts_at': {0: Timestamp('2019-06-02 09:00:00'),
1: Timestamp('2019-06-02 17:00:00'),
2: Timestamp('2019-06-02 14:00:00'),
3: Timestamp('2019-06-03 09:30:00')},
'ends_at': {0: Timestamp('2019-06-02 17:00:00'),
1: Timestamp('2019-06-02 22:30:00'),
2: Timestamp('2019-06-02 22:30:00'),
3: Timestamp('2019-06-03 13:00:00')}}
n2 = {'starts_at': {0: Timestamp('2019-06-01 14:00:00'),
1: Timestamp('2019-06-01 14:41:32.464000'),
2: Timestamp('2019-06-01 15:00:00'),
3: Timestamp('2019-06-02 10:00:00'),
4: Timestamp('2019-06-02 14:00:00'),
5: Timestamp('2019-06-02 17:00:00'),
6: Timestamp('2019-06-02 17:30:00'),
7: Timestamp('2019-06-03 17:00:00')},
'ends_at': {0: Timestamp('2019-06-01 22:30:00'),
1: Timestamp('2019-06-01 22:32:44.862000'),
2: Timestamp('2019-06-01 22:30:00'),
3: Timestamp('2019-06-02 18:30:00'),
4: Timestamp('2019-06-03 00:00:00'),
5: Timestamp('2019-06-03 00:00:00'),
6: Timestamp('2019-06-02 21:00:00'),
7: Timestamp('2019-06-03 23:00:00')}}
df1 = pd.DataFrame(n1)
df2 = pd.DataFrame(n2)
thanks for your help