1

我正在使用 WRDS 库通过 Spyder 连接到 WRDS 数据库。我进口wrds. 根据 WRDS 网站,查询应如下所示: result = wrds.sql('select * from dataset', 'variable')

https://wrds-web.wharton.upenn.edu/wrds/support/Accessing%20and%20Manipulating%20the%20Data/_004Python%20Programming/_001Using%20Python%20with%20WRDS.cfm

但是,我收到此错误:AttributeError: module 'wrds' has no attribute 'sql'

4

1 回答 1

3

您是否将您的 Python 脚本命名为“wrds.py”?这可以解释为什么 python 找不到 .sql。

在我的情况下,以下工作:

import wrds
db = wrds.Connection()
libraries = db.list_libraries()
library = 'compg'

tables = db.list_tables(library=library)
table = 'g_company'

result = db.raw_sql('select * from COMPG.G_COMPANY')
于 2017-10-27T10:05:14.727 回答