numpy学习(二)

数组转置和轴对换

In [44]: %cpaste
Pasting code; enter '--' alone on the line to stop or use Ctrl-D.
:arr=np.arange(15).reshape(3,5)
:--

In [45]: arr
Out[45]:
array([[ 0,  1,  2,  3,  4],
       [ 5,  6,  7,  8,  9],
       [10, 11, 12, 13, 14]])

In [46]: arr.T
Out[46]:
array([[ 0,  5, 10],
       [ 1,  6, 11],
       [ 2,  7, 12],
       [ 3,  8, 13],
       [ 4,  9, 14]])
posted @ 2020-01-14 14:55  sgggr  阅读(109)  评论(0编辑  收藏  举报