Unicode not acceptable input for usecols
kwarg in read_csv()
· Issue #13219 · pandas-dev/pandas (original) (raw)
I caught this bug while updating from version 0.18.0 to 0.18.1. The kwarg usecols
no longer accepts unicode column labels.
Example below:
from io import StringIO import pandas as pd
s = u'''AAA,BBB,CCC,DDD 0.056674973,8,True,a 2.613230982,2,False,b 3.568935038,7,False,a ''' buff = StringIO(s) print pd.read_csv(buff, usecols=[u'AAA', u'BBB'])
ValueError: The elements of 'usecols' must either be all strings or all integers
I note that 0.18.1 introduced the requirement that usecols
be all string or all ints. This makes sense but it looks like the implementation also throws away unicode strings.