I am using pandas 0.12.0 in ipython3 on Ubuntu 13.10, in order to wrangle large tab-delimited datasets in txt files. Using read_table to create a DataFrame from the txt app
I also stumbled upon similar problem. When I was reading as df = pandas.read_csv(csvfile, sep), the first column had this strange format in name:
df.columns[0]
returned this result:
'\xef\xbb\xbfColName'
When I tried selecting this column, I got an error:
df.ColName
returned
AttributeError: 'DataFrame' object has no attribute 'ColName'
After reading this I just used my external program Sublime to change the encoding and save the file as a new file (save with encoding UTF-8, but without BOM).
Afterwards pandas reads the first column name correctly and I am able to select it withdf.ColName
and it returns correct value. Such a small thing that took 45 minutes to solve.
TLDR: Save file with encoding without BOM.