diff options
author | pierregm <pierregm@localhost> | 2009-01-22 05:37:36 +0000 |
---|---|---|
committer | pierregm <pierregm@localhost> | 2009-01-22 05:37:36 +0000 |
commit | 7adaad411b9896f7dd8100cb75e80a313c082d2c (patch) | |
tree | f00a2ac09ba5a43e572419416683cac8332069db /numpy/lib/io.py | |
parent | 8bd6c70d47e16fd81c8e3aefd4b2ec6dd90f38d6 (diff) | |
download | numpy-7adaad411b9896f7dd8100cb75e80a313c082d2c.tar.gz |
* genfromtxt : if names is True, accept a line starting with a comment character as header.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r-- | numpy/lib/io.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py index 303796d5f..5a3a077cb 100644 --- a/numpy/lib/io.py +++ b/numpy/lib/io.py @@ -748,7 +748,14 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, skiprows=0, first_line = fhd.readline() if first_line == '': raise IOError('End-of-file reached before encountering data.') - first_values = split_line(first_line) + if names is True: + first_values = first_line.strip().split(delimiter) + else: + first_values = split_line(first_line) + if names is True: + fval = first_values[0].strip() + if fval in comments: + del first_values[0] # Check the columns to use if usecols is not None: |