# [Numpy-discussion] inconsistent use of axis= keyword argument?

Vidar Gundersen vidar+list at 37mm.no
Thu Feb 23 12:02:02 EST 2006

```(i've been updating the cross reference of MATLAB synonymous
commands in Numeric Python to NumPy. I've kept Numeric/numarray
alternatives in the source XML, but omitted it in the PDF outputs.
feedback is highly appreciated.)

as i was working on this, i started wondering why

a.max(0), a.min(0), a.ptp(0), a.flatten(0), ...

does not allow the axis=0 keyword argument used with
the exact same meaning for:

m.mean(axis=0), m.sum(axis=0), ...

and i also wonder why concatenate can't be used to stack 1-d
arrays on top of each other, returning a 2-d array?
axis relates to the number of axes in the original array(s)?

n [3]: v = arange(9)

In [7]: concatenate((v,v))
Out[7]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8])

In [8]: concatenate((v,v),axis=0)
Out[8]: array([0, 1, 2, 3, 4, 5, 6, 7, 8, 0, 1, 2, 3, 4, 5, 6, 7, 8])

In [15]: concatenate((v,v)).reshape(2,-1)
Out[15]:
array([[0, 1, 2, 3, 4, 5, 6, 7, 8],
[0, 1, 2, 3, 4, 5, 6, 7, 8]])

In [5]: m = v.reshape(3,-1)

In [10]: concatenate((m,m))
Out[10]:
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])

In [11]: concatenate((m,m), axis=0)
Out[11]:
array([[0, 1, 2],
[3, 4, 5],
[6, 7, 8],
[0, 1, 2],
[3, 4, 5],
[6, 7, 8]])

In [12]: concatenate((m,m), axis=1)
Out[12]:
array([[0, 1, 2, 0, 1, 2],
[3, 4, 5, 3, 4, 5],
[6, 7, 8, 6, 7, 8]])

```