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
Post a Comment