Dive into hoge

データ分析関連の備忘録

numpy.ndarrayにappendしたいとき

numpy.ndarrayにattributionとしてappendは用意されていない。
例えば

x = np.arange(-100,101,1)

というとき、

x.append

ではattribution errorとなる(listと同じようには扱えない)。

np.append(x, 1)

とやる必要がある(1には追加したい要素)