I have a dataframe of the form:
Stock VOL
Equity(53 [ABMD]) 0.716368
What I am trying to do is iterate through the dataframe, check if a stock is in my 'short' list, and if it is, reversing the sign of the VOL Column. This is something I've never been very good at, using stack exchange I've got this code:
for i, row in context.outputs.iterrows():
if i in context.shorts:
ifor_val = -context.outputs[i, 'VOL']
context.outputs.set_value(i,'VOL',ifor_val)
However, it throws an error, any suggestions?