python - Numpy array manipulation -


i have array -

x =  array([0, 1, 2, 3,4,5]) 

and want output -

[] [1] [1 2] [1 2 3] [1 2 3 4] [1 2 3 4 5] 

i tried code-

y = np.array([np.arange(1,i) in x+1]) 

but makes list dtype object dont want. want ot integer can indexed later.

and want output this

just outputting way of slicing:

import numpy np x =  np.array([0, 1, 2, 3, 4, 5])  in range(1,len(x) + 1):     print(x[1:i]) 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -