Jun-05-2019, 04:15 PM
i have this code the keeps giving me errors. i cant seem to get the correct syntax, can anyone assist? below is the dataframe and error is: TypeError: tuple indices must be integers or slices, not str
for i in df.itertuples(): if i['Close'] > i['prev']: i['trade2'] = '+' x = '+' continue elif i['Close'] < i['prev']: i['trade2'] = '-' x = '-' continue elif i['Close'] == i['prev']: i['trade2'] = x