diff options
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: |