前提・実現したいこと
pythonで株価のスクレイピングのプログラムを作成しましたが、
添付したようなエラーが発生し、解決できず困っています。
どうか、解決策をご教示お願いします。
Anaconda3 を使用し、JupterLabでプログラム作成
発生している問題・エラーメッセージ
ImportError Traceback (most recent call last)
<ipython-input-2-e18bac21173b> in <module>
1 get_ipython().system('pip install pandas_datareader')
----> 2 from pandas_datareader import data
3 import pandas as pd
4 import matplotlib.pyplot as plt
5 import numpy as np
~\Anaconda3\lib\site-packages\pandas_datareader_init_.py in <module>
1 from ._version import get_versions
----> 2 from .data import (DataReader, Options, get_components_yahoo,
3 get_dailysummary_iex, get_data_enigma, get_data_famafrench,
4 get_data_fred, get_data_google, get_data_moex,
5 get_data_morningstar, get_data_quandl, get_data_stooq,
~\Anaconda3\lib\site-packages\pandas_datareader\data.py in <module>
5 import warnings
6
----> 7 from pandas_datareader.av.forex import AVForexReader
8 from pandas_datareader.av.quotes import AVQuotesReader
9 from pandas_datareader.av.sector import AVSectorPerformanceReader
~\Anaconda3\lib\site-packages\pandas_datareader\av_init_.py in <module>
1 import os
2
----> 3 from pandas_datareader.base import _BaseReader
4 from pandas_datareader._utils import RemoteDataError
5
~\Anaconda3\lib\site-packages\pandas_datareader\base.py in <module>
8 from pandas import DataFrame
9 from pandas import read_csv, concat
---> 10 from pandas.io.common import urlencode
11 from pandas.compat import StringIO, bytes_to_str
12
ImportError: cannot import name 'urlencode' from 'pandas.io.common' (C:\Users\user\Anaconda3\lib\site-packages\pandas\io\common.py)
該当のソースコード
!pip install pandas_datareader
from pandas_datareader import data
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
%matplotlib inline
試したこと
anaconda3 の Spyderで行っても同じエラーが発生
補足情報(FW/ツールのバージョンなど)
ツール情報等として、プログラム実行後の表示を以下の添付します。
Requirement already satisfied: pandas_datareader in c:\users\user\anaconda3\lib\site-packages (0.7.0)
Requirement already satisfied: requests>=2.3.0 in c:\users\user\anaconda3\lib\site-packages (from pandas_datareader) (2.21.0)
Requirement already satisfied: pandas>=0.19.2 in c:\users\user\anaconda3\lib\site-packages (from pandas_datareader) (1.1.5)
Requirement already satisfied: wrapt in c:\users\user\anaconda3\lib\site-packages (from pandas_datareader) (1.10.11)
Requirement already satisfied: lxml in c:\users\user\anaconda3\lib\site-packages (from pandas_datareader) (4.2.5)
Requirement already satisfied: urllib3<1.25,>=1.21.1 in c:\users\user\anaconda3\lib\site-packages (from requests>=2.3.0->pandas_datareader) (1.24.1)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\user\anaconda3\lib\site-packages (from requests>=2.3.0->pandas_datareader) (3.0.4)
Requirement already satisfied: idna<2.9,>=2.5 in c:\users\user\anaconda3\lib\site-packages (from requests>=2.3.0->pandas_datareader) (2.8)
Requirement already satisfied: certifi>=2017.4.17 in c:\users\user\anaconda3\lib\site-packages (from requests>=2.3.0->pandas_datareader) (2020.12.5)
Requirement already satisfied: pytz>=2017.2 in c:\users\user\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas_datareader) (2018.7)
Requirement already satisfied: numpy>=1.15.4 in c:\users\user\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas_datareader) (1.17.3)
Requirement already satisfied: python-dateutil>=2.7.3 in c:\users\user\anaconda3\lib\site-packages (from pandas>=0.19.2->pandas_datareader) (2.7.5)
Requirement already satisfied: six>=1.5 in c:\users\user\anaconda3\lib\site-packages (from python-dateutil>=2.7.3->pandas>=0.19.2->pandas_datareader) (1.12.0)