“import pandas.io.data as web”给我一个错误,说没有pandas.io.data的模块名称
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/51886766/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
"import pandas.io.data as web " gives me a error saying no module name for pandas.io.data
提问by Ted pottel
Im just learning python and trying to use it for stock anlyses. using stockstats.
我只是在学习 python 并尝试将其用于股票分析。使用股票统计。
I installed stockstats by pip install stockstats
imported pandas import pandas
tried to import data import pandas.io.data got a error saying module pandas.io.data does not exist
我通过 pip install stockstats 安装了 stockstats
进口Pandas进口Pandas
试图导入数据 import pandas.io.data 得到一个错误,说模块 pandas.io.data 不存在
回答by Matt Messersmith
I got this error out of the box with Anaconda 4.4:
我在使用 Anaconda 4.4 时遇到了这个错误:
>>> import pandas.io.data
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/anaconda3/lib/python3.6/site-packages/pandas/io/data.py", line 2, in <module>
"The pandas.io.data module is moved to a separate package "
ImportError: The pandas.io.data module is moved to a separate package (pandas-datareader). After installing the pandas-datareader package (https://github.com/pydata/pandas-datareader), you can change the import ``from pandas.io import data, wb`` to ``from pandas_datareader import data, wb``.
The error message is pretty nice. It recommends you go install pandas-datareader
from https://github.com/pydata/pandas-datareader
. Then change your import to from pandas_datareader import data
.
错误信息非常好。它建议您pandas-datareader
从https://github.com/pydata/pandas-datareader
. 然后将您的导入更改为from pandas_datareader import data
.
Or you can just pip install pandas-datareader
.
或者你可以pip install pandas-datareader
。
After that, from pandas_datareader import data
works as expected:
之后,from pandas_datareader import data
按预期工作:
Matthews-MacBook-Pro:python matt$ python
Python 3.6.4 |Anaconda, Inc.| (default, Jan 16 2018, 12:04:33)
[GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from pandas_datareader import data
>>>