【やりたいこと】 行列の各列の和,もしくは各行の和を求める. 2次元配列を前提に進める. 【実現方法】 numpy.sum()を使う. キーワード引数”axis”でどの次元方向に和を取るかを指定できる. axis=0とすれば,各列の和を取った(行)ベクトルが出力される. axis=1とすれば,各行の和を取った(列)ベクトルが出力される. 行列内の総和を求めるnumpy.ndarray.sum()とは異なるので注意. 【サンプルコード】 This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Uni