df fruit year sale important
0 apple 2010
1 apple 2011
2 apple 2012
3 apple 2013
4 apple 2014 True Yes
5 apple 2015 True
6 apple 2017 True
7 apple 2018 True
7 apple 2019
8 apple 2020 True Yes
9 banana 2010
...
How could I generate the "important" column?
It's Yes if per fruit: (1) There is a sale that year and (2) there was no sale the year before and (3) there is at least a 3-year gap between that year and the previous "important" year.