summaryrefslogtreecommitdiff
path: root/numpy/lib/npyio.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r--numpy/lib/npyio.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py
index f69ca0c73..98b4b6e35 100644
--- a/numpy/lib/npyio.py
+++ b/numpy/lib/npyio.py
@@ -845,6 +845,11 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None,
continue
if usecols:
vals = [vals[i] for i in usecols]
+ if len(vals) != N:
+ line_num = i + skiprows + 1
+ raise ValueError("Wrong number of columns at line %d"
+ % line_num)
+
# Convert each value according to its column and store
items = [conv(val) for (conv, val) in zip(converters, vals)]
# Then pack it according to the dtype's nesting