I have a len(x), and need create a vector of that lenght (lenx), starting with a 0, so the last one should be len(x)-1.
how can I do this in python?
CodePudding user response:
I am not sure of what you mean by "vector", but I guess it is either of:
A Python list:
vector = [i for i in range(len(x))]
or
vector = list(range(len(x)))
A numpy array:
np.array(range(len(x)))