Pandas read_csv: Ignore second header line

Viewed 3691

I have data files like this:

# comment
# comment
Header1;Header2
Unit1;Unit2
0;123
1;231
2;512

I'd like to read them with Pandas.read_csv using the line Header1;Header2 as headers but ignoring Unit1;Unit2.

What I have so far is

pd.read_csv(datafile, sep=';', comment='#', header=[0,1])

which does almost what I want, except that it creates a multiheader from both header lines:

  Header1 Header2
    Unit1   Unit2
0       0     123
1       1     231
2       2     512

How can I tell Pandas to take only the first line as header?

edit: This is my desired output:

  Header1 Header2
0       0     123
1       1     231
2       2     512
2 Answers
Related