LoginSignup
0
2

More than 3 years have passed since last update.

Numpy 便利なメソッド一覧

Posted at

配列の累計和を算出する

import numpy as np

y = [0, 1, 2, 3, 4, 5]

np.cumsum(y) # 累計和がndarrayで出力される
# [ 0  1  3  6 10 15]

np.cumsum(y).tolist() # リストにもできる
# [0, 1, 3, 6, 10, 15]

随時更新中

0
2
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
0
2