IndexError: list index out of range
jveisdal opened this issue · comments
When trying to retrieve stats in Python 3.7.3, I get the following IndexError:
>>> from retrieval import get_data
>>> df = get_data(fname='stats.html')
Found 3 entries in table.
multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 121, in worker
result = (True, func(*args, **kwds))
File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 128, in process_entry
IndexError: list index out of range
"""
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 227, in get_data
return process_in_parallel(t, processes=processes)
File "/Users/user/Dropbox/Projects/Test/Stats/retrieval.py", line 174, in process_in_parallel
for i, r in enumerate(pool.imap_unordered(process_entry, table_rows_str)):
File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/multiprocessing/pool.py", line 748, in next
raise value
IndexError: list index out of range
Line 128 in retrieval is:
tags = [li.text for li in tags[0].find_all('li')]
Any idea what the problem might be?
not the most fun answer but the best way to find out what the problem is to learn to debug
import pdb; pdb.set_trace()
you can check the axis by panda query and assign it to a variable