[Numpy-discussion] Using loadtxt to read in mixed data types

Stéfan van der Walt stefan@sun.ac...
Thu Jul 2 17:53:21 CDT 2009

Hi Peter

2009/7/3 Peter Kelley <paz117@gmail.com>:
> I get TypeError: data type not understood, and I think it is because the
> event format is a list of strings not data types. Does anyone have know how
> to convert the list of strings into the data types for dtype.

In your example the problem actually comes in with the string 'long',
which cannot be converted to a dtype using


As for the strings, I think you'll have to pick the length of the
longest string and use that as the dtype:

np.dtype('S5') # where 5 is the longest

Good luck.


More information about the Numpy-discussion mailing list