python - 使用 Python quandl.get 获取 TypeError:raise_on_status
问题描述
我正在关注关于 ML 和 quandl 的教程,并为 python3 导入了 quandl 和依赖项。当我跑
import quandl
data = quandl.get("EIA/PET_RWTC_D")
print(data.head())
我有一个 quandl 帐户,此代码来自 quandl python 文档,因为我想确保教程没有错(https://www.youtube.com/watch?v=JcI5Vnw0b2c&list=PLQVvvaa0QuDfKTOs3Keq_kaG2P55YRn5v&index=2)(我确定它是小写的 quandl 用于导入,因为它因视频的发布日期而不同),我也尝试使用我的 api_key 并在 quandl.get() 中使用该 arg
我得到错误:
Traceback (most recent call last):
File "ml_regression1.py", line 4, in <module>
quandl.get("EIA/PET_RWTC_D", authtoken="MyAuthTokenPlaceHolder")
File "/usr/local/lib/python3.5/dist-packages/quandl/get.py", line 48, in get
data = Dataset(dataset_args['code']).data(params=kwargs, handle_column_not_found=True)
File "/usr/local/lib/python3.5/dist-packages/quandl/model/dataset.py", line 47, in data
return Data.all(**updated_options)
File "/usr/local/lib/python3.5/dist-packages/quandl/operations/list.py", line 14, in all
r = Connection.request('get', path, **options)
File "/usr/local/lib/python3.5/dist-packages/quandl/connection.py", line 38, in request
return cls.execute_request(http_verb, abs_url, **options)
File "/usr/local/lib/python3.5/dist-packages/quandl/connection.py", line 42, in execute_request
session = cls.get_session()
File "/usr/local/lib/python3.5/dist-packages/quandl/connection.py", line 58, in get_session
adapter = HTTPAdapter(max_retries=cls.get_retries())
File "/usr/local/lib/python3.5/dist-packages/quandl/connection.py", line 74, in get_retries
raise_on_status=False)
TypeError: __init__() got an unexpected keyword argument 'raise_on_status'
任何帮助都会很棒,谢谢。
解决方案
pip3 install --upgrade urllib3
为我解决了这个问题(urllib3 不是最新的)。
推荐阅读
- git - 如何撤消 git stash 应用
- powershell - 如何测量远程机器上的 Tcp 和 Icmp 连接时间:像 Ping
- pyspark - 派斯帕克 | 将 RDD 从带有值列表的键 > 带有键列表的值转换
- git - 如何在不丢失 git 历史记录的情况下将现有的本地 repo 推送到新的远程 repo
- d - 在编译时从现有列表构造列表
- java - 如何让 Java 使用 JDBC 查看包含在单独模式文件中的 OracleSQL 序列
- python-2.7 - Python 中的 1000 位数字
- mysql - CONCAT 中的 GROUP_CONCAT
- php - 显示在特定位置的 WordPress 自定义帖子类型
- r - 根据多列中的匹配字符串组合两个数据帧