Closed
Description
The following example runs into an error
import numpy as np
from io import StringIO
s = StringIO(u'''# This comment should be ignored
field_name_0 field_name_1
0 1
2 3''')
data = np.genfromtxt(s, names=True)
The first line, minus the comment delimiter is being taken as the names for the dtype, causing the following error.
ValueError: Some errors were detected !
Line #2 (got 2 columns instead of 5)
Line #3 (got 2 columns instead of 5)
Line #4 (got 2 columns instead of 5)
This seems inconsistent with the fact that the following is fine, and that the documentation for the names and comments fields does not suggest this behavior.
import numpy as np
from io import StringIO
s = StringIO(u'''field_name_0 field_name_1
# This comment should be ignored
0 1
2 3''')
data = np.genfromtxt(s, names=True)
Was this behavior intended? If so I would like to update the documentation on the names field. If not, I'd change the names=True to ignore lines that are entirely comments.
Metadata
Metadata
Assignees
Labels
No labels