BUG: "index_col=False" not working when "usecols" is specified in read_csv · Issue #9082 · pandas-dev/pandas (original) (raw)

Wes' old blog post indicates that you can read the malformed FEC data by passing index_col=False, the docstring for read_csv seems to also say this. It doesn't look like this works anymore?

[9]: cat test.csv
cmte_id,cand_id,cand_nm,contbr_nm,contbr_city,contbr_st,contbr_zip,contbr_employer,contbr_occupation,contb_receipt_amt,contb_receipt_dt,receipt_desc,memo_cd,memo_text,form_tp,file_num,tran_id,election_tp
C00410118,"P20002978","Bachmann, Michele","HARVEY, WILLIAM","MOBILE","AL","366010290","RETIRED","RETIRED",250,20-JUN-11,"","","","SA17A","736166","A1FDABC23D2D545A1B83","P2012",
C00410118,"P20002978","Bachmann, Michele","HARVEY, WILLIAM","MOBILE","AL","366010290","RETIRED","RETIRED",50,23-JUN-11,"","","","SA17A","736166","A899B9B0E223743EFA63","P2012",

[10]: cols = ['cand_nm', 'contbr_st', 'contbr_employer', 'contb_receipt_amt', 
              'contbr_occupation', 'contb_receipt_amt', 'contb_receipt_dt']


# raises an error
pd.read_csv("test.csv", usecols=cols, index_col=False)

# gets "incorrect" columns
pd.read_csv("test.csv", usecols=cols)