The answer will be very obvious I think, but I don't see it at the moment.
How can I convert a record array back to a regular ndarray?
Suppose I have following simple structured array:
x = np.array([(1.0, 4.0,), (2.0, -1.0)], dtype=[('f0', '
then I want to convert it to:
array([[ 1., 4.],
[ 2., -1.]])
I tried asarray and astype, but that didn't work.
UPDATE (solved: float32 (f4) instead of float64 (f8))
OK, I tried the solution of Robert (x.view(np.float64).reshape(x.shape + (-1,))
), and with a simple array it works perfectly. But with the array I wanted to convert it gives a strange outcome:
data = np.array([ (0.014793682843446732, 0.006681123282760382, 0.0, 0.0, 0.0, 0.0008984912419691682, 0.0, 0.013475529849529266, 0.0, 0.0),
(0.014793682843446732, 0.0066811232