I get the same error when I try to set the index_col
reading a file into a Panda
's data-frame:
df = pd.read_csv('my_file.tsv', sep='\t', header=0, index_col=['0']) ## or same with the following
df = pd.read_csv('my_file.tsv', sep='\t', header=0, index_col=[0])
I have never encountered such an error previously. I still am trying to figure out the reason behind this (using @Eric Leschinski explanation and others).
Anyhow, the following approach solves the problem for now until I figure the reason out:
df = pd.read_csv('my_file.tsv', sep='\t', header=0) ## not setting the index_col
df.set_index(['0'], inplace=True)
I will update this as soon as I figure out the reason for such behavior.