[Numpy-discussion] genfromtext advice
Tue Sep 1 05:08:28 CDT 2009
I tried to load a ASCII table into a string array. Unfortunately, this table has
some empty chells
Here it is:
After having converted this into a text file I tried this:
$ np.genfromtxt('alphanum_to-text.txt', dtype=np.str_, delimiter='|',
But I got an error:
1043 dtype = np.dtype(ttype)
-> 1045 output = np.array(data, dtype)
1046 if usemask:
1047 if dtype.names:
ValueError: setting an array element with a sequence
I sometimes experience this error message with text read in. Could this message
be made more helpful like telling in which line of the input file this occurs?
This could really reduce the trial and error.
What would be the correct way to read this data in?
More information about the NumPy-Discussion