diff options
author | Stefan van der Walt <stefan@sun.ac.za> | 2009-05-27 23:27:19 +0000 |
---|---|---|
committer | Stefan van der Walt <stefan@sun.ac.za> | 2009-05-27 23:27:19 +0000 |
commit | a2bf56aaf98ea150079ee5d05da21b18de68252a (patch) | |
tree | bbf02c6c62a98cfd74906564cb45843130258a1b /numpy/lib/io.py | |
parent | 81a26d7fea2f4bf913426ec587ed211bf7c33fe5 (diff) | |
download | numpy-a2bf56aaf98ea150079ee5d05da21b18de68252a.tar.gz |
loadtxt: allow shaped dtypes.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r-- | numpy/lib/io.py | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py index cfcced55e..03274845c 100644 --- a/numpy/lib/io.py +++ b/numpy/lib/io.py @@ -424,7 +424,10 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None, def flatten_dtype(dt): """Unpack a structured data-type.""" if dt.names is None: - return [dt] + # If the dtype is flattened, return. + # If the dtype has a shape, the dtype occurs + # in the list more than once. + return [dt.base] * int(np.prod(dt.shape)) else: types = [] for field in dt.names: |