Help us understand the problem. What is going on with this article?

Pandas_datareaderでFredの株価情報が取得できなくなった

More than 1 year has passed since last update.

米ドルと日経平均株価・ダウ平均株価を日々取得して記録するために
Fredから株価情報を取得してグラフ化するスクリプトを書いて管理していた。
Fredのウェブページはこちら(https://fred.stlouisfed.org/)

しかし2018年を迎えてから、途端にFredから株価情報が取得できなくなった。
(”pandas_datareader._utils.RemoteDataError: Unable to read URL:”
 というエラーメッセージが出てきた)

ソースコード

ソースコードはこちら。
去年の段階ではこれで正しく取得できていることは確認済。

GetStock.py
import datetime
import pandas_datareader.data as web
import matplotlib.pyplot as plt

start = datetime.datetime(2017, 1, 1)
end = datetime.datetime(2017, 12, 9)

df = web.DataReader(["DEXJPUS"], "fred", start, end)
df.plot()

plt.xlabel("Date")
plt.ylabel("Yen / Doller")
plt.savefig("JPNUSD.jpg", bbox_inches="tight")

df2 = web.DataReader(["NIKKEI225", "DJIA"], "fred", start, end)

df2.plot()

plt.xlabel("Date")
plt.ylabel("NIKKEI225/DJIA")
plt.savefig("NIKKEI225-DJIA.jpg", bbox_inches="tight")


実行結果

python GetStock.py で実行した結果、下記エラー出力。
※ユーザ名は"USERNAME"として記載しています。

Traceback (most recent call last):
  File "GetStock.py", line 22, in <module>
    df = web.DataReader(["DEXJPUS"], "fred", start, end)
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/data.py", line 145, in DataReader
    session=session).read()
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/fred.py", line 24, in read
    return self._read()
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/fred.py", line 49, in _read
    df = concat([fetch_data(url, n) for url, n in zip(urls, names)],
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/fred.py", line 49, in <listcomp>
    df = concat([fetch_data(url, n) for url, n in zip(urls, names)],
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/fred.py", line 38, in fetch_data
    resp = self._read_url_as_StringIO(url)
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 90, in _read_url_as_StringIO
    response = self._get_response(url, params=params)
  File "/Users/USERNAME/anaconda/lib/python3.6/site-packages/pandas_datareader/base.py", line 139, in _get_response
    raise RemoteDataError('Unable to read URL: {0}'.format(url))

pandas_datareader._utils.RemoteDataError: Unable to read URL: http://research.stlouisfed.org/fred2/series/DEXJPUS/downloaddata/DEXJPUS.csv

エラ―メッセージ中に出力されているanacondaとPandasを最新のバージョンに更新し直して再度実行したが改善せず。

再インストールしてリトライしてみますが
原因わかる方いらっしゃいましたらご教授頂けると幸いです…!

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away