【问题标题】:Quandl Error , API InvalidQuandl错误,API无效
【发布时间】:2017-08-22 09:17:36
【问题描述】:

截图在这里:

错误:禁止错误(状态 403) 无法执行代码。引发 API 错误。尝试使用 quandl API 显示数据的标题。

PS : 在 Python3.5 中使用 pip install quandl 安装 quandl

代码

   1> import pandas as pd

   2> import quandl as Q

   3> data = Q.get_table('WIKI/PRICES')

   4> print(df.head())

错误

File "C:\Python35\lib\site-packages\quandl\connection.py", line 85,           in handle_api_error
    raise klass(message, resp.status_code, resp.text, resp.headers, code)
quandl.errors.quandl_error.ForbiddenError: (Status 403) (Quandl Error QEPx04) A valid API key is required to retrieve data. Please check your API key and try again. You can find your API key under your account settings.

【问题讨论】:

  • 尝试阅读 Quandl 说明...

标签: pandas numpy scikit-learn data-science quandl


【解决方案1】:

quandl.ApiConfig.api_key 需要设置为 Quandl API 识别您并访问数据。
所以注册Quandl 并获取 api 密钥并在您的代码中使用相同的密钥,如下所示:

import quandl
quandl.ApiConfig.api_key = '#enter api key here'
data = quandl.get_table('WIKI/PRICES')
print(data.head())

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-06-16
    • 2014-08-08
    • 2017-02-08
    • 2011-04-22
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多