我试图从dropbox链接(https://www.dropbox.com/s/i77mern7joxc9ur/TestResultCodelistVoC.xlsx)解析一个表。这是一个.xlsx
表,到目前为止,我已经尝试了两种方法
方法1
codeID_url = 'https://www.dropbox.com/s/i77mern7joxc9ur/TestResultCodelistVoC.xlsx'
tables = pd.read_html(codeID_url)
df_codeID = tables[0]
给予
ValueError: No tables found
这是有道理的,因为最后,我不是在解析html页面中的表。上面的命令对于本页(https://www.ecdc.europa.eu/en/covid-19/variants-concern)中的表非常有效
方法2
codeID_url = 'https://www.dropbox.com/s/i77mern7joxc9ur/TestResultCodelistVoC.xlsx'
data = pd.read_excel(codeID_url,'TestResultCodelistVoC')
给出:
XLRDError: Unsupported format, or corrupt file: Expected BOF record; found b'<!DOCTYP'
我确实在这个错误上找到了一个主题here,尽管所有的答案都是处理一个本地.xls
文件,在我的例子中,我试图解析一个网页/链接,它最终是一个.xls
文件
我还遇到了一个使用dropbox token的解决方案,尽管我首先想尝试在不使用dropbox帐户的情况下下载前面提到的表,如果可能的话
将
?dl=1
添加到URL的末尾相关问题 更多 >
编程相关推荐