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
![[Image: uc?id=1tPZp-XC6NcJomwzbvx2UC4jDO5hDhz87]](https://drive.google.com/uc?id=1tPZp-XC6NcJomwzbvx2UC4jDO5hDhz87)
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