Here is my dataframe:
Nets y_start draw_length color bar_label label_pos
2018-07-30 06:04:10 11319 0.0 11319.0 grey 11,319 11319
2018-08-20 08:11:45 21889 11319.0 10570.0 grey 21,889 21889
2018-09-10 08:39:19 16270 21889.0 -5619.0 red 16,270 16270
I need to subtract 10000 from the existing lable_pos if the color is red.
I tried this but I get invalid syntax-
df['label_pos'] = df['lable_pos'] - 10000 if df['color'].isin('red')
what I'm after is the last row in this example is:
2018-09-10 08:39:19 16270 21889.0 -5619.0 red 16,270 15270