python - What does np.cumsum(0) do? -


a = np.array([[1,2,3], [4,5,6]]) np.cumsum(a) 

i know output of above array([ 1, 3, 6, 10, 15, 21]) displays cumulative sums of array a.

however, have trouble understand following. cumsum(0) do?

np.random.randn(365).cumsum(0) 

this isn't numpy.cumsum(0)

here, 0 axis parameter of cumsum method of array object defined np.random.randn(365). can omitted in case (default none flatten array, array flat here)

np.cumsum function taking array first argument, whereas in second example cumsum method of array (both same computation, first 1 having no axis, flattens in process)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -