I have Dataframe 1:
Hotel DateFrom DateTo Room
BBB 2019-10-29 2020-03-27 DHS
BBB 2020-03-28 2020-10-30 DHS
BBB 2020-10-31 2021-03-29 DHS
BBB 2021-03-30 2099-01-01 DHS
And Dataframe 2:
Hotel DateFrom DateTo Room Food
BBB 2020-03-01 2020-04-24 DHS A
BBB 2020-04-25 2020-05-03 DHS B
BBB 2020-05-04 2020-05-31 DHS C
BBB 2020-06-01 2020-06-22 DHS D
BBB 2020-06-23 2020-08-26 DHS E
BBB 2020-08-27 2020-11-30 DHS F
I need to check if each row in df1 and if df1_DateFrom is between df2_DateFrom and df2_DateTo. Then i need to get that food code from df2 to new column in df1 or as new df3 shown below.
The result would look like this:
df3:
Hotel DateFrom DateTo Room Food
BBB 2019-10-29 2020-03-27 DHS
BBB 2020-03-28 2020-10-30 DHS A
BBB 2020-10-31 2021-03-29 DHS F
BBB 2021-03-30 2099-01-01 DHS
I would really appreciate any help with this. I am kinda new on Pandas and still learning and i must say that it is bit complicated for me.