数组转置和轴对换

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]])

相关文章:

  • 2022-12-23
  • 2021-12-01
  • 2022-01-11
猜你喜欢
  • 2022-12-23
  • 2021-11-08
  • 2021-11-30
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案