【发布时间】:2019-07-11 08:07:00
【问题描述】:
ModuleNotFoundError: 没有名为“pandas_datareader”的模块
您好,我需要有关此 ModuleNotFoundError 的帮助:没有名为“pandas_datareader”的模块。我已经使用 pip install 命令安装了超过 10 倍的 pandas_datareader,但是在 Pycharm 和 python 3.7 的默认 IDLE 中都返回了这个错误。我知道这个论坛上已经有几个威胁解决了这个问题,但到目前为止没有帮助我。 自白:我是 python 的新手(目前有 40 小时的经验)从石油工程转向编程。
import datetime
import pandas_datareader.data as web
import matplotlib.pyplot as plt
from matplotlib import style
style.use('fivethirtyeight')
start = datetime.datetime(2010, 1, 1)
end = datetime.datetime.now()
df = web.DataReader("XOM", "morningstar", start, end)
df.reset_index(inplace=True)
df.set_index("Date", inplace=True)
df = df.drop("Symbol", axis=1)
print(df.head())
df['High'].plot()
plt.legend()
plt.show()
这是它返回的结果
Python 3.7.2 (tags/v3.7.2:9a3ffc0492, Dec 23 2018, 23:09:28) [MSC v.1916 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>>
============= RESTART: C:\Users\fred-PC\Desktop\data analysis.py =============
Traceback (most recent call last):
File "C:\Users\fred-PC\Desktop\data analysis.py", line 3, in <module>
import pandas_datareader.data as web
ModuleNotFoundError: No module named 'pandas_datareader'
【问题讨论】:
-
您使用哪个命令来安装模型?
-
点安装pandas_datareader
标签: python-3.7 pandas-datareader