简体   繁体   中英

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/

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.

Even if I use the code exactly as from the pandas instructions I get the same error.

The pandas instructions can be found here:

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:

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

Any ideas how to solve that?

The file seems to have been renamed to 5_Industry_Portfolios_TXT on the remote server.

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; the .zip should be omitted and pandas seems to be expecting the TXT files rather than the CSVs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM