I'm studying Data Science with Python Pandas. But, I'm not good at handling data. So, I need some help.
df1
>>> df1
stamp id col1 col2
0 100000 1 100 60
1 100000 2 100 30
2 100001 1 10 10
3 100001 1 20 30
4 100001 2 20 10
5 100001 2 20 90
6 100001 3 30 10
7 100002 1 300 30
8 100002 4 40 60
df2
>>> df2
start end id val
0 100000 100001 1 1
1 100002 100003 4 1
Using python3 pandas dataframe, How do I add a new column to the data that has the same 'id' value and 'stamp' values between 'start' and 'end' values?
@ Want to make result like this
>>> result
stamp id col1 col2 val
0 100000 1 100 60 1
1 100000 2 100 30 0
2 100001 1 10 10 1
3 100001 1 20 30 1
4 100001 2 20 10 0
5 100001 2 20 90 0
6 100001 3 30 10 0
7 100002 1 300 30 0
8 100002 4 40 60 1
How can i make it?