Spyder与numpy和pandas配合得很好,但是与Quandl一起,我得到以下错误(在spyder中):
>>> import Quandl
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ImportError: No module named Quandl
但是从终端Quandl安装后就没有问题:
$ sudo easy_install quandl
Password:
Searching for quandl
Reading http://pypi.python.org/simple/quandl/
Best match: Quandl 1.8.1
Downloading https://pypi.python.org/packages/source/Q/Quandl/Quandl-1.8.1.tar.gz#md5=f67bef937eb7522d70cf39ed0de740c1
Processing Quandl-1.8.1.tar.gz
Running Quandl-1.8.1/setup.py -q bdist_egg --dist-dir /tmp/easy_install-BEwINw/Quandl-1.8.1/egg-dist-tmp-aBuphk
zip_safe flag not set; analyzing archive contents...
Adding Quandl 1.8.1 to easy-install.pth file
Installed /Library/Python/2.7/site-packages/Quandl-1.8.1-py2.7.egg
Processing dependencies for quandl
Finished processing dependencies for quandl
而且我还可以直接从终端(在python2.7中)直接使用该库:
$ python2.7
Python 2.7.5 (default, Aug 25 2013, 00:04:04)
[GCC 4.2.1 Compatible Apple LLVM 5.0 (clang-500.0.68)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import Quandl
>>> data= Quandl.get(['GOOG/NASDAQ_AAPL.4','GOOG/NASDAQ_MSFT.4'])
No authentication tokens found: usage will be limited.
See www.quandl.com/api for more information.
Returning Dataframe for [u'GOOG.NASDAQ_AAPL.4', u'GOOG.NASDAQ_MSFT.4']
>>> data
<class 'pandas.core.frame.DataFrame'>
DatetimeIndex: 8294 entries, 1981-03-11 00:00:00 to 2014-01-03 00:00:00
Data columns (total 2 columns):
GOOG.NASDAQ_AAPL - Close 8294 non-null values
GOOG.NASDAQ_MSFT - Close 7027 non-null values
dtypes: float64(2)
为什么spyder无法与Quandl配合使用?
一定有人在我之前尝试过爬这座山。
通过stackoverflow查看时,解决方案未被发现,但是Google小组向我指出:
answer here!
最佳答案
我最初写了Quandl
(大写),但似乎出现了错误,但出现了错误。它对我来说是小写字母(import quandl
)。
quandl主页上的python代码在这一点上是错误的:
Quandl.get("OFDP/FUTURE_VX6", trim_start="2004-05-19", trim_end="2014-10-16")
因为他们使用大写的Q。
关于python-2.7 - Spyder中的Python Quandl,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/20928605/