Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
473 views
in Technique[技术] by (71.8m points)

python - IndexError when trying to use second table on a page using pandas read_html

I am trying to create a pandas dataframe from the second table on a webpage, and getting this error when running my code:

"Traceback (most recent call last): File "hup.py", line 51, in full_table2 = dataframe2[1] IndexError: list index out of range"

I am able to print the dataframe at the index specified, so I know the data is present. I have similar code, using the table at index 0, which runs smoothly. Code is as follows, the 'full_football_ref' variable specifies the link I'm using:

        dataframe2 = pd.read_html(full_football_ref)
        full_table2 = dataframe2[1]

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...