I have a txt file with the following format(simplified):
date this that other
2007-05-25 11:00:00 10 20 30
2007-05-25 11:10:00 15 18 30
2007-05-25 11:20:00 10 27 30
2007-05-25 11:30:00 20 35 30
2007-05-25 11:50:00 30 20
2007-05-25 12:00:00 30 13
2007-05-25 12:10:00 30 13
The first raw is strings defining what is the column above them. The first column it is clear that is time. It can be observed also that some values are missing. I do not want to erase the rows that some values are missing. As i want to make some calculations with that data later I thought to use numpy to import that data by using numpy.loadtxt
:
data = numpy.loadtxt('data.txt')
It gives an error ValueError: could not convert string to float: b'date'
due to the first raw. Using:
data = numpy.genfromtxt('data.txt')
gives an error Line #51028 (got 38 columns instead of 37)
for many lines which is because some values are missing. What should i try?