diff options
author | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-08-27 15:52:24 +0200 |
---|---|---|
committer | Julian Taylor <jtaylor.debian@googlemail.com> | 2014-08-27 15:52:24 +0200 |
commit | 0210cca2e10199dabc81b64fca2085ab62645b7f (patch) | |
tree | 961185f1c1a0f0ea2a2142937c22370c5b17b7ff /numpy/lib/npyio.py | |
parent | 145422826e34e880eb16a85bea6cee01cb83556f (diff) | |
parent | 709a06d0e9db862a8dd519db13724a4c59de7d69 (diff) | |
download | numpy-0210cca2e10199dabc81b64fca2085ab62645b7f.tar.gz |
Merge pull request #5006 from dhomeier/ioconv_usecols
BUG: fix genfromtxt check of converters when using usecols
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 21d98efe7..641203f34 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1575,22 +1575,25 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, for (miss, fill) in zipit] # Update the converters to use the user-defined ones uc_update = [] - for (i, conv) in user_converters.items(): + for (j, conv) in user_converters.items(): # If the converter is specified by column names, use the index instead - if _is_string_like(i): + if _is_string_like(j): try: - i = names.index(i) + j = names.index(j) + i = j except ValueError: continue elif usecols: try: - i = usecols.index(i) + i = usecols.index(j) except ValueError: # Unused converter specified continue - # Find the value to test: + else: + i = j + # Find the value to test - first_line is not filtered by usecols: if len(first_line): - testing_value = first_values[i] + testing_value = first_values[j] else: testing_value = None converters[i].update(conv, locked=True, |