[Numpy-discussion] savetxt trouble

Neal Becker ndbecker2 at gmail.com
Wed Feb 20 08:25:30 EST 2013


I tried to save a vector as a csv, but it didn't work.

The vector is:
a[0,0]
array([-0.70710678-0.70710678j,  0.70710678+0.70710678j,
        0.70710678-0.70710678j,  0.70710678+0.70710678j,
       -0.70710678-0.70710678j,  0.70710678-0.70710678j,
       -0.70710678+0.70710678j, -0.70710678+0.70710678j,
       -0.70710678-0.70710678j, -0.70710678-0.70710678j,
        0.70710678-0.70710678j, -0.70710678-0.70710678j,
       -0.70710678+0.70710678j,  0.70710678-0.70710678j,
        0.70710678-0.70710678j,  0.70710678+0.70710678j,
        0.70710678-0.70710678j, -0.70710678-0.70710678j,
       -0.70710678-0.70710678j,  0.70710678-0.70710678j,
        0.70710678+0.70710678j,  0.70710678+0.70710678j,
       -0.70710678+0.70710678j,  0.70710678+0.70710678j,
       -0.70710678-0.70710678j, -0.70710678+0.70710678j,
        0.70710678-0.70710678j, -0.70710678+0.70710678j,
        0.70710678+0.70710678j,  0.70710678+0.70710678j,
        0.70710678-0.70710678j, -0.70710678-0.70710678j,
        0.70710678-0.70710678j, -0.70710678-0.70710678j,
       -0.70710678+0.70710678j,  0.70710678+0.70710678j,
        0.70710678-0.70710678j,  0.70710678-0.70710678j,
        0.70710678+0.70710678j, -0.70710678+0.70710678j])

 np.savetxt ('test.out', a[0,0], delimiter=',')

The saved txt file says:
 (-7.071067811865540120e-01+-7.071067811865411334e-01j)
 (7.071067811865535679e-01+7.071067811865415775e-01j)
 (7.071067811865422437e-01+-7.071067811865529018e-01j)
 (7.071067811865520136e-01+7.071067811865431318e-01j)
 ...




More information about the NumPy-Discussion mailing list