1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

transposeで入れ替え

Last updated at Posted at 2018-08-01

Pythonの組み込み関数の1つであるtranspose
引数にaxisを指定することで,入れかえが可能です.

In:
test = np.array([[1,2],[3,4]])
test.transpose(1,0)

Out:
array([[1, 3],
       [2, 4]])

transpose()を使う意味がなくなりますが,test.transpose(0,1)testと等しくなります.

In:
test = np.array([[1,2],[3,4]])
test.transpose(0,1)

Out: 
array([[1, 2],
       [3, 4]])
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?