LoginSignup
7

More than 1 year has passed since last update.

posted at

pandasから株価のデータ取得できなくなった件

2021/7/1からpandas_datareaderから株価のデータを取得すると以下のエラーが発生

pandas_datareader._utils.RemoteDataError: Unable to read URL: https://finance.yahoo.com/quote/004840.KS/history?period1=1623006000&period2=1626548399&interval=1d&frequency=1d&filter=history

解決方法

import pandas
from pandas_datareader import data as pdr
import yfinance as yfin
yfin.pdr_override()

>>> df = pdr.get_data_yahoo('1514.T',start ='2021-06-07', end='2021-07-07')
[*********************100%***********************]  1 of 1 completed
>>> df
             Open   High    Low  Close  Adj Close  Volume
Date                                                     
2021-06-07  130.0  131.0  129.0  131.0      131.0  510300
2021-06-08  130.0  131.0  129.0  130.0      130.0  289200
2021-06-09  131.0  131.0  128.0  129.0      129.0  279600
2021-06-10  129.0  129.0  126.0  128.0      128.0  742700
2021-06-11  128.0  130.0  126.0  130.0      130.0  369300
2021-06-14  130.0  130.0  128.0  128.0      128.0  101700
2021-06-15  129.0  129.0  126.0  128.0      128.0  417900
2021-06-16  128.0  131.0  127.0  129.0      129.0  733900
2021-06-17  128.0  129.0  127.0  127.0      127.0  457600
2021-06-18  128.0  128.0  125.0  125.0      125.0  842300
2021-06-21  124.0  124.0  121.0  122.0      122.0  789900
2021-06-22  124.0  125.0  123.0  125.0      125.0  293200
2021-06-23  125.0  126.0  125.0  126.0      126.0  285800
2021-06-24  125.0  126.0  125.0  126.0      126.0  148800
2021-06-25  126.0  129.0  125.0  127.0      127.0  675100
2021-06-28  126.0  128.0  126.0  128.0      128.0  240200
2021-06-29  127.0  128.0  125.0  125.0      125.0  371500
2021-06-30  126.0  128.0  126.0  126.0      126.0  205200
2021-07-01  126.0  128.0  126.0  126.0      126.0  227500
2021-07-02  127.0  128.0  126.0  128.0      128.0  220200
2021-07-05  128.0  128.0  126.0  126.0      126.0  240000
2021-07-06  127.0  128.0  126.0  127.0      127.0  212600

issue リンク

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
What you can do with signing up
7