I have a list tsv file which I am parsing and want to convert it into an array.
Here is the file format -
jobname1 queue maphours reducehours
jobname2 queue maphours reducehours
code
with open(file.tsv) as tsv:
line = [elem.strip().split('\t') for elem in tsv]
vals = np.asarray(line)
print vals[0]
print vals[4]
Vals currently returns the following output -
['job1', 'queue', '1.0', '0.0\n']
['job2', 'queue', '1.0', '0.0\n']
I want to convert each element in a row in the entire file to an array object -
vals[0] = job1 vals[1] = queue vals[2] = 1.0 vals[3] = 0.0
How do i achieve this?