Using Python dict values from external file in WRDS CRSP query
问题 I would like to read dictionary values (CRSP PERMNOS) from an external file (a Python dict) and use them in a function that will return rows from a particular table. The code below, adapted from the WRDS Python Support site, works well with the PERMNO values written inline. def main(): parm = {'permnos': ('22074', '20482', '10049', '19641', '18980')} data = db.raw_sql('SELECT date,permno,comnam,cusip FROM crsp.dseall WHERE permno in %(permnos)s', params=parm) data.to_csv(r'cusip-result-2.csv'