「NumPy」多次元配列のサンプル

書式
import numpy as np
np.array([[要素1, 要素2, 要素3], )

使用例

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
import numpy as np
'''多次元配列を作るには、array()関数に多次元リストを渡します'''
cft = np.array([[22, 33, 44], [55, 66, 77], [88, 99, 11]])
print(cft)
import numpy as np '''多次元配列を作るには、array()関数に多次元リストを渡します''' cft = np.array([[22, 33, 44], [55, 66, 77], [88, 99, 11]]) print(cft)
import numpy as np
'''多次元配列を作るには、array()関数に多次元リストを渡します'''
cft = np.array([[22, 33, 44], [55, 66, 77], [88, 99, 11]])
print(cft)

実行結果

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
[[22 33 44]
[55 66 77]
[88 99 11]]
[[22 33 44] [55 66 77] [88 99 11]]
[[22 33 44]
 [55 66 77]
 [88 99 11]]

 

NumPy

Posted by arkgame