I need to parse a ndarray to a fixed shape. I need help in using the dtype, so it parse the full array, not just the first match.
a
Out[193]: '1\t2\t3\t4\t5\t6\t'
ar = np.loadtxt(StringIO(a),dtype={'names':('x','y'),'formats':('f8','f8')}).view(np.recarray)
ar.x
Out[195]: array(1.0)
ar.y
Out[196]: array(2.0)
Being that I wanted:
ar.x
Out[195]: array(1.0,3.0,5.0)
ar.y
Out[196]: array(2.0,4.0,6.0)
If someone could explain the settings in dtype that make it happend would be very nice =)