Question: I have two distinct data frames. Both contain timestamps and corresponding values. I'm aiming to subset or provide boolean indexing where the time from one df falls within two timepoints from a second df. df contains names and start/end times. I want to use this info for df2. So where the same name is present (John), I want to provide a boolean index if Time falls within Start Time and End Time. df = pd.DataFrame({ 'Start Time' : ['2010-03-20 09:27:00','2010-03-20 10:15:00','2010-03-20 11:10:38','2010-03-20 11:32:15','2010-03-20 11:45:38'], 'End Time' : ['2010-03-20 09:40:00','2010-03-20 10:32:15','2010-03-20 11:35:38','2010-03-20 11:38:15','2010-03-20 11:50:38'], "Name":['John', 'Brian', 'Suni', 'Gary', 'Li'], "Occ":[1, 2, 3, 4, 5], }) df2 = pd.DataFrame({ 'Time' : ['2010-03-20 09:27:28','2010-03-20 09:29:15','2010-03-20 09:30:38','2010-03-20 09:32:15','2010-03-20 09:38:38', '2010-03-20 10:15:08','2010-03-20 10:16:36','2010-03-20 10:30:12','2010-03-20 10:31:08','2010-03-20 10:32:48'], 'Name':['John', 'John', 'John', 'John', 'John', 'John', 'John', 'Li', 'Li', 'Li'], }) df['Start Time'] = pd.to_datetime(df['Start Time']) df['End Time'] = pd.to_datetime(df['End Time']) df2['Time'] = pd.to_datetime(df2['Time']) mask1 = (df2['Time'] > df['Start Time']) & (df2['Time'] < df['End Time']) raise ValueError("Can only compare identically-labeled Series objects") ValueError: Can only compare identically-labeled Series objects  I/O: Use mask to find rows that meet criteria and subset df2. True True True True True False False False False False Time Name 0 2010-03-20 09:27:28 John 1 2010-03-20 09:29:15 John 2 2010-03-20 09:30:38 John 3 2010-03-20 09:32:15 John 4 2010-03-20 09:38:38 John  Edit 2: Is it possible to assign values from df to df2 where same conditions are met? For ex, df is the same except for an additional col: df = pd.DataFrame({ 'Start Time' : ['2010-03-20 09:27:00','2010-03-20 10:15:00','2010-03-20 11:10:38','2010-03-20 11:32:15','2010-03-20 11:45:38'], 'End Time' : ['2010-03-20 09:40:00','2010-03-20 10:32:15','2010-03-20 11:35:38','2010-03-20 11:38:15','2010-03-20 11:50:38'], "Name":['John', 'Brian', 'Suni', 'John', 'Li'], "Occ":[1, 2, 3, 4, 5], }) df2 = pd.DataFrame({ 'Time' : ['2010-03-20 09:27:28','2010-03-20 09:29:15','2010-03-20 09:30:38','2010-03-20 09:32:15','2010-03-20 09:38:38', '2010-03-20 11:11:08','2010-03-20 11:16:36','2010-03-20 11:30:12','2010-03-20 11:31:08','2010-03-20 11:32:48', ], 'Name':['John', 'John', 'John', 'John', 'John', 'Suni', 'Suni', 'Li', 'John', 'John', ], "desc":[6, 6, 6, np.nan, np.nan, 89, 89, np.nan, 2, 2 ], })  Could we use the same function but pass Occ to df2 for the relevant rows. I/O:  Time Name desc msk Occ 0 2010-03-20 09:27:28 John 6.0 True 1.0 1 2010-03-20 09:29:15 John 6.0 True 1.0 2 2010-03-20 09:30:38 John 6.0 True 1.0 3 2010-03-20 09:32:15 John NaN True 1.0 4 2010-03-20 09:38:38 John NaN True 1.0 5 2010-03-20 11:11:08 Suni 89.0 True 3.0 6 2010-03-20 11:16:36 Suni 89.0 True 3.0 7 2010-03-20 11:30:12 Li NaN False NaN 8 2010-03-20 11:31:08 John 2.0 False NaN 9 2010-03-20 11:32:48 John 2.0 True 4.0 

Answer: You can merge your dataframes as first approach. You need to reset_index to preserve the df2 index: idx = (df2.reset_index().merge(df, on='Name') .loc[lambda x:x['Time'].between(x['Start Time'], x['End Time']), 'index']) msk = df2.index.isin(idx)  You have to re Output: >>> msk array([ True, True, True, True, True, False, False, False, False, False]) >>> pd.Series(msk, index=df2.index) 0 True 1 True 2 True 3 True 4 True 5 False 6 False 7 False 8 False 9 False dtype: bool  Maybe merge_asof can be better? idx = (pd.merge_asof(df2.reset_index().sort_values('Time'), df.sort_values('Start Time'), left_on='Time', right_on='Start Time', by='Name') .loc[lambda x:x['Time'].between(x['Start Time'], x['End Time']), 'index']) msk = df2.index.isin(idx)  Edit 2 You can do: cx = (df2.reset_index().merge(df, on='Name') .loc[lambda x:x['Time'].between(x['Start Time'], x['End Time'])] .set_index('index').rename_axis(None)) df2['mask'] = df2.index.isin(cx.index) df2['Occ'] = cx['Occ']  Output: >>> df2 Time Name desc mask Occ 0 2010-03-20 09:27:28 John 6.0 True 1.0 1 2010-03-20 09:29:15 John 6.0 True 1.0 2 2010-03-20 09:30:38 John 6.0 True 1.0 3 2010-03-20 09:32:15 John NaN True 1.0 4 2010-03-20 09:38:38 John NaN True 1.0 5 2010-03-20 11:11:08 Suni 89.0 True 3.0 6 2010-03-20 11:16:36 Suni 89.0 True 3.0 7 2010-03-20 11:30:12 Li NaN False NaN 8 2010-03-20 11:31:08 John 2.0 False NaN 9 2010-03-20 11:32:48 John 2.0 True 4.0