我正在使用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'
最佳答案
您是否将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')
关于python - WRDS库和SQL?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/40668215/