Given this data frame...:
DF = pd.DataFrame({'COL1': ['A', 'B', 'C', 'D','D','D'],
'COL2': [11032, 1960, 11400, 11355, 8, 7],
'year': ['2016', '2017', '2018', '2019', '2020', '2021']})
DF
COL1 COL2 year
0 A 11032 2016
1 B 1960 2017
2 C 11400 2018
3 D 11355 2019
4 D 8 2020
5 D 7 2021
If the following conditions are met:
- COL1 = 'D'
- year = '2021' (please treat it as a string)
Then change the value in COL2 to 100.
Alternatively, what if year is treated as an int?