I have a data frame that contains many data. One column named 'x' (the most relevant), contains numbers and I want to get just the last digit to then operate if it meets the condition.
df = pd.DataFrame({'value':[500, 200, 100],
'x':[125, 129, 349]})
value x
0 500 125
1 200 129
2 100 349
Once having the data frame, I want to check if the last digit inside the value 'x' is 5 and if so then multiply by 2 the column 'value' and if not, don't do any operation. The end result should be:
df2 = pd.DataFrame({'value':[500, 200, 100],
'x':[125, 129, 349],
'value2':[1000, 200, 100]})
value x value2
0 500 125 1000
1 200 129 200
2 100 349 100