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 | | B | 2018-08-25 | 2019-09-24 | | C | 2018-08-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?
没有评论:
发表评论