python-2.7 - Spyder 中的 Python Quandl

标签 python-2.7 numpy pandas spyder quandl

Spyder 与 numpy 和 pandas 配合得很好,但使用 Quandl 时出现以下错误(在 spy 程序中):

>>> 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/

相关文章:

python - 如何对 Pandas 数据框的单行进行排序

python - python中的分组列表元素

python - 编程错误 : You must not use 8-bit bytestrings

python - Numpy 查找二维数组中出现的次数

python - 掩码二维 numpy 数组

python - 在 python 中向上或向下舍入一半的快速方法

python - openpyxl - 能够从图表中删除边框吗?

python - 在 Windows 上安装 scipy 时出错

python - 根据指定属性分组

python - 只写从 pandas df 到 csv 的前 N ​​行