my first dataframe
dataframe1=
id number count1 count2
1 5225 10 30
2 2222 3 40
3 7121 30 50
second dataframe
dataframe2=
id value1 value2
1 4000 6000
3 2500 3300
3 7000 8000
output
id value1 value2 number count1 count2
1 4000 6000 5225 10 30
3 7000 8000 7121 30 50
I tried
dataframe2['a']=(dataframe1['number']>= dataframe2['value1']) & (dataframe1['number'] <= dataframe2['value2'])
it gave True False values in column a, What I want to do is this: For each value in the Dataframe1 "number" column, search if it is equal to or between ANY of the "value1" and "value2" pair values of Dataframe2. Additionally, for this "number1" and "number2" pair values, its respective "id" must match the "id" in Dataframe. If this is all true, then I want to insert along with number, count1 and count2 in dataframe2