[Numpy-discussion] loadtxt

Francesc Alted faltet@pytables....
Thu Oct 2 03:31:08 CDT 2008


A Thursday 02 October 2008, Nils Wagner escrigué:
> Hi all,
>
> how can I load ASCII data if the file contains characters
> instead of floats
>
> Traceback (most recent call last):
>    File "test_csv.py", line 2, in <module>
>      A = loadtxt('ca6_sets.csv',dtype=char ,delimiter=';')
> NameError: name 'char' is not defined

You would need to specify the length of your strings.  Try with 
dtype="SN", where N is the expected length of the strings.

Cheers,

-- 
Francesc Alted


More information about the Numpy-discussion mailing list