This code is set up to read two columns of data, and then print the first column into the first numpy array and then the second column into the second numpy array.
def read2coldata(filename):
import numpy
b = []
f = open(filename,"r")
lines = f.readlines()
f.close()
for line in lines:
a = line.split()
for i in a:
b.append(i)
return (numpy.array(b[::2]),numpy.array(b[1::2]))
However this gives:
(array(['1.5', '8', '16', '17'], dtype='|S3'), array(['4', '5', '6', '6.2'], dtype='|S3'))
How do I get rid of the dtype="|S3" parts to just leave:
(array(["1.5","8","16","17"], array(["4","5","6","6.2"])
x.astype(float).