diff options
author | Travis Oliphant <oliphant@enthought.com> | 2006-01-24 17:33:33 +0000 |
---|---|---|
committer | Travis Oliphant <oliphant@enthought.com> | 2006-01-24 17:33:33 +0000 |
commit | 5beecfe93c4755dc18726b8135e79ef06cdfc470 (patch) | |
tree | 0cc3c8d271f49e0fd8e2fd85ff9380aa790454ed /numpy/lib/shape_base.py | |
parent | 2718405df3959d6add724e40a7a4d2e6588d8999 (diff) | |
download | numpy-5beecfe93c4755dc18726b8135e79ef06cdfc470.tar.gz |
Add ndmin to array constructors.
Diffstat (limited to 'numpy/lib/shape_base.py')
-rw-r--r-- | numpy/lib/shape_base.py | 14 |
1 files changed, 2 insertions, 12 deletions
diff --git a/numpy/lib/shape_base.py b/numpy/lib/shape_base.py index 0515a74ab..74d763821 100644 --- a/numpy/lib/shape_base.py +++ b/numpy/lib/shape_base.py @@ -120,10 +120,7 @@ def atleast_1d(*arys): """ res = [] for ary in arys: - ary = asarray(ary) - if len(ary.shape) == 0: - ary = ary.reshape(1) - res.append(ary) + res.append(asarray(ary,ndmin=1)) if len(res) == 1: return res[0] else: @@ -143,14 +140,7 @@ def atleast_2d(*arys): """ res = [] for ary in arys: - ary = asarray(ary) - if len(ary.shape) == 0: - result = ary.reshape(1,1) - elif len(ary.shape) == 1: - result = ary[newaxis,:] - else: - result = ary - res.append(result) + res.append(asarray(ary,ndmin=2)) if len(res) == 1: return res[0] else: |