[Numpy-discussion] loadtxt

Francesc Alted faltet at pytables.org
Thu Oct 2 04:31:08 EDT 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