I am following a tutorial and I don't know why I got this error:
<ipython-input-61-d59f7a5a07ab> in extract_featuresets(ticker)
2 tickers, df = process_data_for_labels(ticker)
3 df['{}_target'.format(ticker)] = list(map(buy_sell_hold,
----> 4 df['{}_{}1d'.format(ticker)],
5 df['{}_{}2d'.format(ticker)],
6 df['{}_{}3d'.format(ticker)],
IndexError: Replacement index 1 out of range for positional args tuple
Here is my code:
tickers, df = process_data_for_labels(ticker)
df['{}_target'.format(ticker)] = list(map(buy_sell_hold,
df['{}_{}1d'.format(ticker)],
df['{}_{}2d'.format(ticker)],
df['{}_{}3d'.format(ticker)],
df['{}_{}4d'.format(ticker)],
df['{}_{}5d'.format(ticker)],
df['{}_{}6d'.format(ticker)],
df['{}_{}7d'.format(ticker)],))
Here is the link to the tutorial: https://www.youtube.com/watch?v=zPp80YM2v7k
ticker
must be a two-element tuple because there are two placeholders in the format string. Is it? – Bowlintickers
instead ofticker
... notice the previous line only unpacks one element'{}_target'.format(ticker)
– Idiotic