[英]Python pandas HTTPError:“ HTTP Error 404: Not Found” when using pandas import function for Kenneth French Data Library
I am using a standard package of python pandas to import data from the Kenneth French Data Library: http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/ 我使用标准的python pandas包从Kenneth法语数据库导入数据: http : //mba.tuck.dartmouth.edu/pages/faculty/ken.french/
But I am just getting the error: HTTPError: HTTP Error 404: Not Found Even though the code worked fine a few weeks ago and I changed absolutely nothing. 但我只是得到错误:HTTPError:HTTP错误404:找不到尽管几周前代码工作正常但我一无所获。
Even if I use the code exactly as from the pandas instructions I get the same error. 即使我使用与pandas指令完全相同的代码,我也会得到相同的错误。
The pandas instructions can be found here: 大熊猫的说明可以在这里找到:
http://pandas.pydata.org/pandas-docs/stable/remote_data.html http://pandas.pydata.org/pandas-docs/stable/remote_data.html
The code I use can be found when you search for: "Fama/French" and is the following: 当您搜索“Fama / French”时,可以找到我使用的代码,如下所示:
import pandas.io.data as web
ip = web.DataReader("5_Industry_Portfolios", "famafrench")
ip[4].ix[192607]
The pandas version I am using is 0.16.1 我使用的熊猫版本是0.16.1
Any ideas how to solve that? 任何想法如何解决?
The file seems to have been renamed to 5_Industry_Portfolios_TXT
on the remote server. 该文件似乎已在远程服务器上重命名为
5_Industry_Portfolios_TXT
。
import pandas.io.data as web
ip = web.DataReader("5_Industry_Portfolios_TXT", "famafrench")
print(ip[4].ix[192607])
gives: 得到:
1 Cnsmr 5.43
2 Manuf 2.73
3 HiTec 1.83
4 Hlth 1.77
5 Other 2.16
Name: 192607, dtype: float64
Have a look at the links on http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html for the proper file names; 查看http://mba.tuck.dartmouth.edu/pages/faculty/ken.french/data_library.html上的链接,了解正确的文件名; the .zip should be omitted and pandas seems to be expecting the TXT files rather than the CSVs.
应该省略.zip,并且pandas似乎期待TXT文件而不是CSV。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.