I'm trying to gather data to test the impact of rainy weather on traffic congestion. I have two different data frames:
DF no. 1: Based on a 4-hours time frame, this shows the congestion statistics on a 6-hours block in which I have indicated with 1/0 of whether it is congested or not.
|date_time | congestion_YN |
|---------------------| ------------- |
|2022/01/03 00:00:00 | 1 |
|2022/01/03 06:00:00 | 1 |
|2022/01/03 12:00:00 | 0 |
|2022/01/03 18:00:00 | 1 |
|2022/01/04 00:00:00 | 0 |
|2022/01/04 06:00:00 | 0 |
...
DF no. 2: Based on a daily time frame, this shows whether a particular day is a rainy day or not, also use 1/0
|date_time | rainy_day_YN |
|---------------------| ------------- |
|2022/01/03 00:00:00 | 1 |
|2022/01/04 00:00:00 | 0 |
|2022/01/05 00:00:00 | 1 |
...
I want to combine DF2 to DF1 so that I can see which 6-hours time block satisfies both conditions, the end DF I need should look like this
|date_time | congestion_YN | rainy_day_YN |
|---------------------| ------------- | ------------ |
|2022/01/03 00:00:00 | 1 | 1 |
|2022/01/03 06:00:00 | 1 | 1 |
|2022/01/03 12:00:00 | 0 | 1 |
|2022/01/03 18:00:00 | 1 | 1 |
|2022/01/04 00:00:00 | 0 | 0 |
|2022/01/04 06:00:00 | 0 | 0 |
...
I just start learning python a few months ago and this is my first project. I don't know where to start or what to look for. Any helps would be greatly appreciated.