2009/7/21 Christopher Barker <[email protected]>:
> In [35]: line
> Out[35]: '-1.000000E+00-1.000000E+00-1.000000E+00-1.000000E+00
> 1.250000E+00 1.250000E+00'
>
> In [36]: a = np.array(line)
>
> In [37]: a
> Out[37]:
> array('-1.000000E+00-1.000000E+00-1.000000E+00-1.000000E+00 1.250000E+00
> 1.250000E+00',
>       dtype='|S78')
>
> but now when I try to split it up:
>
> In [38]: a = a.view(dtype='S13')
>
> I get:
>
> ValueError: new type not compatible with array.

You cannot use view on an array scalar, so you'll have to convert to
an array first:

x = x.reshape((1,))
x.view('S1')

Regards
Stéfan
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to