diff options
author | Matti Picus <matti.picus@gmail.com> | 2019-05-19 09:34:58 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-05-19 09:34:58 +0300 |
commit | ecb402499dba2d105b2714a55259352c31a62bd5 (patch) | |
tree | bcf388f945fc2eb9d4c151f776e030a65fb7fed7 /numpy/lib/npyio.py | |
parent | db595a0c4064956d2f2f904ed4a76443322bb7e9 (diff) | |
parent | 7495de475c8c578a0c39b09bc55a88a93aa1985a (diff) | |
download | numpy-ecb402499dba2d105b2714a55259352c31a62bd5.tar.gz |
Merge branch 'master' into npy-2.1
Diffstat (limited to 'numpy/lib/npyio.py')
-rw-r--r-- | numpy/lib/npyio.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/numpy/lib/npyio.py b/numpy/lib/npyio.py index 0a284d78f..1845305d1 100644 --- a/numpy/lib/npyio.py +++ b/numpy/lib/npyio.py @@ -1549,7 +1549,8 @@ def fromregex(file, regexp, dtype, encoding=None): def genfromtxt(fname, dtype=float, comments='#', delimiter=None, skip_header=0, skip_footer=0, converters=None, missing_values=None, filling_values=None, usecols=None, - names=None, excludelist=None, deletechars=None, + names=None, excludelist=None, + deletechars=''.join(sorted(NameValidator.defaultdeletechars)), replace_space='_', autostrip=False, case_sensitive=True, defaultfmt="f%i", unpack=None, usemask=False, loose=True, invalid_raise=True, max_rows=None, encoding='bytes'): @@ -1716,6 +1717,16 @@ def genfromtxt(fname, dtype=float, comments='#', delimiter=None, array((1, 1.3, b'abcde'), dtype=[('intvar', '<i8'), ('fltvar', '<f8'), ('strvar', 'S5')]) + An example to show comments + + >>> f = StringIO(''' + ... text,# of chars + ... hello world,11 + ... numpy,5''') + >>> np.genfromtxt(f, dtype='S12,S12', delimiter=',') + array([(b'text', b''), (b'hello world', b'11'), (b'numpy', b'5')], + dtype=[('f0', 'S12'), ('f1', 'S12')]) + """ if max_rows is not None: if skip_footer: |