2017-02-13から1日間の記事一覧
numpyの多次元配列を一次元配列にしたいときは、reshape(-1,)かravel()を使えば良い import numpy as np # サンプルデータ生成(3 × 3) > x = np.arange(9).reshape(3, 3) # 表示 > x array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) # 方法1 > x.reshape(-1,) ar…
numpyの多次元配列を一次元配列にしたいときは、reshape(-1,)かravel()を使えば良い import numpy as np # サンプルデータ生成(3 × 3) > x = np.arange(9).reshape(3, 3) # 表示 > x array([[0, 1, 2], [3, 4, 5], [6, 7, 8]]) # 方法1 > x.reshape(-1,) ar…