[PYTHON] Numpy Useful method list

Calculate the cumulative sum of arrays

import numpy as np

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

np.cumsum(y) #Cumulative sum is output as ndarray
# [ 0  1  3  6 10 15]

np.cumsum(y).tolist() #Can also be a list
# [0, 1, 3, 6, 10, 15]

Updating from time to time

Recommended Posts

Numpy Useful method list
list and numpy
[Python] Calculation method with numpy
Linear regression method using Numpy
List of useful coding styles
Python / numpy> list (numpy array) file save / load
Handle numpy with Cython (method by memoryview)