
Feb. 20, 2013
8:46 a.m.
Robert Kern wrote:
On Wed, Feb 20, 2013 at 1:25 PM, Neal Becker <ndbecker2@gmail.com> wrote:
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, ... 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) ...
What were you expecting? A single row? savetxt() always writes out len(arr) rows. Reshape your vector into a (1,N) array if you want a single row.
Ah, thanks!