[SciPy-user] concatenating arrays of different dimensions

bgbg bg bgbg.bg@gmail....
Mon Feb 2 02:12:33 CST 2009

```Hello,
Consider an Octave code that concatenates an array and a vector:
octave:1> a = [1, 2, 3];
octave:2> b = [ 11, 22, 33; 44, 55 66];
octave:3> c = [a; b]
c =

1    2    3
11   22   33
44   55   66

octave:4>

How do I emulate this behavior in Python (scipy)? This is what i tried:

In [37]: from scipy import array
In [38]: a = array([1,2,3])
In [39]: b = array([ [11,22,33], [44, 55, 66]])
In [40]: c = [a, b]
In [41]: print c
[array([1, 2, 3]), array([[11, 22, 33],
[44, 55, 66]])]
In [42]: # not good
In [43]: c = concatenate((a,b))
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: arrays must have same number of dimensions
In [44]: c = concatenate((a,b),1)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
ValueError: arrays must have same number of dimensions
In [45]:
```