summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2008-07-22 00:49:31 +0000
committerdhuard <dhuard@localhost>2008-07-22 00:49:31 +0000
commite41b0e3b2222095c2eb75952602fc8b779798cbc (patch)
tree4a54e4259a0bf873d07ffb9eb6e1dc01d3bd39ae /numpy/lib/io.py
parent75779e8651774e1f86fd6656d851d22411e2224b (diff)
downloadnumpy-e41b0e3b2222095c2eb75952602fc8b779798cbc.tar.gz
Committed patch from Ryan May. It fixes error in loadtxt occurring when usecols is not None and dtypes are given.
I added the test suggested by Ryan.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 36723f1d8..b1ae192ec 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -292,8 +292,12 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None,
if converters is None:
converters = {}
if dtype.names is not None:
- converterseq = [_getconv(dtype.fields[name][0]) \
- for name in dtype.names]
+ if usecols is None:
+ converterseq = [_getconv(dtype.fields[name][0]) \
+ for name in dtype.names]
+ else:
+ converters.update([(col,_getconv(dtype.fields[name][0])) \
+ for col,name in zip(usecols, dtype.names)])
for i,line in enumerate(fh):
if i<skiprows: continue