• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
21 views

Problem :

 I'm a newbie with Python's arrays and I don't understand how I can avoid below error:
python typeerror: list indices must be integers or slices, not str
by (6.9k points)  

1 Answer

0 votes

Solution :

Please Note array_length should be an integer and not a string:

array_length = len(array_dates)

Also note, your for loop should be constructed using range:

for i in range(array_length):  # Use `xrange` for python 2.

Third, i will increment automatically, so delete the bellow line:

i += 1

Further Readings:

https://github.com/uber/ludwig/issues/76

by (21.9k points)  
edited by
...