Reading data into numpy array from text file
If you don't want the first n
rows, try (if there is no missing data):
data = numpy.loadtxt(yourFileName,skiprows=n)
or (if there are missing data):
data = numpy.genfromtxt(yourFileName,skiprows=n)
If you then want to parse the header information, you can go back and open
the file parse the header, for example:
fh = open(yourFileName,'r')for i,line in enumerate(fh): if i is n: break do_other_stuff_to_header(line)fh.close()