I have data I want to plot and analyse, looking like:
0101
1 3
2 4
3 6
I use skip_header in genfromtxt to load the file 2 column data, however I also need the header for reference.
Is there a way to get the header back?
I have data I want to plot and analyse, looking like:
0101
1 3
2 4
3 6
I use skip_header in genfromtxt to load the file 2 column data, however I also need the header for reference.
Is there a way to get the header back?
I am not sure that this is implemented in numpy.genfromtxt(). You may have to call the function twice, once for the header, and a second time for the data. Or you may want to have a look at the functions offered by pandas, such as read_table.
You can try with pd.read_csv:
data = pd.read_csv(filename, sep=" ")
So that the first line is read as header