summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index cb8c63666..6f6815e81 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -1104,8 +1104,8 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None,
descr = dtype.descr
dtype = np.dtype([descr[_] for _ in usecols])
names = list(dtype.names)
- # If the dtype is None, update the names
- elif names is not None:
+ # If `names` is not None, update the names
+ elif (names is not None) and (len(names) > nbcols):
names = [names[_] for _ in usecols]