llSourcell / predicting_stock_prices

This is the coding challenge for "Predicting Stock Prices" by @Sirajology on Youtube
297 stars 196 forks source link

invalid literal for int() with base 10 #10

Open farhaan23 opened 5 years ago

farhaan23 commented 5 years ago

Traceback (most recent call last): File "farhaan.py", line 45, in get_data('aapl.csv') File "farhaan.py", line 19, in get_data dates.append(int(row[0].split('-')[0])) ValueError: invalid literal for int() with base 10: '14:54'

Help pls

ghost commented 5 years ago

Try: dates.append(int(row[0].split('/')[0]))

The 'split' is looking for a date with '-' and not '/'. E.g. 01-01-2019 Yahoo data is normally this way 01/01/2019, however other data sets may have '-'

aswinr22 commented 4 years ago

There is a decimal number in your CSV 'date' column, you need to change it manually to integer