Merge pandas dataframes where one value is between two others [duplicate]
问题 This question already has answers here : How to join two dataframes for which column values are within a certain range? (5 answers) Closed last year . I need to merge two pandas dataframes on an identifier and a condition where a date in one dataframe is between two dates in the other dataframe. Dataframe A has a date (\"fdate\") and an ID (\"cusip\"): I need to merge this with this dataframe B: on A.cusip==B.ncusip and A.fdate is between B.namedt and B.nameenddt . In SQL this would be