I am trying to import data using numpy's genfromtxt with header names and non-homogeneous data types. Every time I run the program I get the error:
Traceback (most recent call last):
raise ValueError(errmsg)
ValueError: Some errors were detected !
Line #8 (got 6 columns instead of 1)
Line #9 (got 6 columns instead of 1)
Line #10 (got 6 columns instead of 1)
Line #11 (got 6 columns instead of 1)
Line #12 (got 6 columns instead of 1)
I have already gone through this question but it didn't solve my problem. It is a very simple problem, but I can't figure out what is wrong. The code and data is included:
Code
import numpy as np
data = np.genfromtxt('Data.dat', comments='#', delimiter='\t', names=True, dtype=None).transpose()
print data
Tab-separated data
# -----
# -----
# -----
# -----
# -----
# -----
# -----
column_1 column_2 column_3 column_4 column_5 column_6
1 2 3 A 1 F
4 3 2 B 2 G
1 4 3 C 3 H
5 6 4 D 4 I
Update
In short what I require is a way of converting the first valid line after skip_header to be the first uncommented valid line with the optional argument names=True.