2

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查看解决方案时未被发现,但谷歌小组向我指出:

在这里回答!

4

5 回答 5

1

我最初写Quandl(大写)并得到一个错误,就像你正在做的那样。它对我来说是小写的(import quandl)。

quandl主页上的python代码在这一点上是错误的:

Quandl.get("OFDP/FUTURE_VX6", trim_start="2004-05-19", trim_end="2014-10-16")

因为他们使用大写的 Q。

于 2014-10-20T13:35:51.350 回答
1

从 3.5 降级到 3.4 后,我在 Anaconda Python 中遇到了这个问题。

我尝试同时使用pip install quandlconda install quandl(Anaconda 特有的)以及其他一些变体,例如卸载和重新安装。

最后我意识到旧值Quandl被缓存了。完全删除Anaconda/Lib/site-packages/Qandl文件夹后(卸载后),pip install quandl工作正常。

希望这对某人有帮助!

于 2016-09-27T08:37:00.790 回答
1

只需使用 import quandl 而不是 import Quandl 就可以了。我有同样的问题。最好的

于 2018-04-27T17:07:22.890 回答
0

最近对我有用的是在终端上从 python 下载 quandl 包,然后从 Anaconda 导航器/环境中去未安装的包并在那里找到 quandl 并安装它。然后在重新启动 spyder 时, import quandl 没有显示错误

于 2020-09-03T17:36:55.900 回答
-1

you could just use the CSV links and download manually using url

import urllib2
response = urllib2.urlopen('http://www.quandl.com/api/v1/datasets/OFDP/FUTURE_VX1.csv?&trim_start=2004-05-03&trim_end=2014-01-07&sort_order=desc')
html = response.read()

then parse appropriately

于 2014-01-09T18:55:25.203 回答