diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-22 20:28:00 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2008-09-22 20:28:00 +0000 |
commit | f1855ef6c44ff037b606cbc0673a536ece31a945 (patch) | |
tree | d056013285f0c17abc2489b0c95861c6fcf3bdf6 /numpy/lib/io.py | |
parent | 3060e39a4dc5ffc4852d7f7b2adc8f8d79bde0df (diff) | |
download | numpy-f1855ef6c44ff037b606cbc0673a536ece31a945.tar.gz |
Ignore unused converters in `loadtxt`.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r-- | numpy/lib/io.py | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py index 93c955942..caa790809 100644 --- a/numpy/lib/io.py +++ b/numpy/lib/io.py @@ -378,7 +378,11 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None, # By preference, use the converters specified by the user for i, conv in (user_converters or {}).iteritems(): if usecols: - i = usecols.index(i) + try: + i = usecols.index(i) + except ValueError: + # Unused converter specified + continue converters[i] = conv # Parse each line, including the first |