summaryrefslogtreecommitdiff
path: root/numpy/lib/io.py
diff options
context:
space:
mode:
authordhuard <dhuard@localhost>2008-04-03 14:06:33 +0000
committerdhuard <dhuard@localhost>2008-04-03 14:06:33 +0000
commit8784a1abd5c74dbd134a04a4bcd0f050fe650ed6 (patch)
tree35c66ab63c3c41aa432c2165091a12c87c41f87d /numpy/lib/io.py
parent5fc40c054140b8f43eb2838f892367ca05bcf302 (diff)
downloadnumpy-8784a1abd5c74dbd134a04a4bcd0f050fe650ed6.tar.gz
Fixed a bug with loadtxt and savetxt failing on record arrays. This addresses ticket #623.
Added simple tests for loadtxt and savetxt.
Diffstat (limited to 'numpy/lib/io.py')
-rw-r--r--numpy/lib/io.py6
1 files changed, 2 insertions, 4 deletions
diff --git a/numpy/lib/io.py b/numpy/lib/io.py
index 521148a5f..7be3c9804 100644
--- a/numpy/lib/io.py
+++ b/numpy/lib/io.py
@@ -312,9 +312,7 @@ def loadtxt(fname, dtype=float, comments='#', delimiter=None, converters=None,
X.append(row)
X = np.array(X, dtype)
- r,c = X.shape
- if r==1 or c==1:
- X.shape = max([r,c]),
+ X = np.squeeze(X)
if unpack: return X.T
else: return X
@@ -355,7 +353,7 @@ def savetxt(fname, X, fmt='%.18e',delimiter=' '):
X = np.asarray(X)
origShape = None
- if len(X.shape)==1:
+ if len(X.shape)==1 and not hasattr(X.dtype, 'names'):
origShape = X.shape
X.shape = len(X), 1
for row in X: