Get HTML table into pandas Dataframe, not list of dataframe objects

前端 未结 2 514
别跟我提以往
别跟我提以往 2020-12-31 09:15

I apologize if this question has been answered elsewhere but I have been unsuccessful in finding a satisfactory answer here or elsewhere.

I am somewhat new to python

2条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-31 09:50

    From http://pandas.pydata.org/pandas-docs/version/0.17.1/io.html#io-read-html, "read_html returns a list of DataFrame objects, even if there is only a single table contained in the HTML content".

    So df = df[0].dropna(axis=0, thresh=4) should do what you want.

提交回复
热议问题