Im a little confused about how to incorporate if, then statements into dataframes. DF:
name | date1 | date2 |
---|---|---|
A | 2018-08-24 | 2019-09-24 |
A | 2018-08-25 | 2018-08-24 |
A | 2017-08-25 | 2018-08-24 |
A | 2016-08-25 | 2018-08-24 |
B | 2018-08-25 | 2019-09-24 |
C | 2018-08-25 | 2019-09-24 |
C | 2015-04-25 | 2019-09-24 |
C | 2018-06-25 | 2019-09-24 |
C | 2008-06-25 | 2019-09-24 |
D | 2018-06-25 | 2019-09-24 |
D | 2008-06-25 | 2019-09-24 |
I want to first compare the values in column, 'name'. If these values are the same, I want to proceed with a calculation for the other two columns.
For example, the first two rows have the same string in 'name', so I want to proceed evaluating if date2-date1 overlaps between the first row and second row.
What is the best way to approach this?