I want to select the year '2019/0'(string) from the column 'year of entry' and only multiply their 'grades' times 2 which is in another column
year of entry | Grades |
---|---|
2019/0 | 14 |
2010/0 | 21 |
2019/0 | 15 |
this is what I have tried so far:
df.loc[df("Year of Entry"),'2018/9'] = df("Grades")*2
its been giving me an error and im not sure if this is the right method.
CodePudding user response:
You can use:
df.loc[df['year of entry'].eq('2019/0'), 'Grades'] *= 2
NB. the modification is in place.
modified df
:
year of entry Grades
0 2019/0 28
1 2010/0 21
2 2019/0 30