I want to do linspace to an array. Just like following:
a = np.array([2, 4, 6])
b = vectorize(np.array)(0, a, 5)
I would like something back that looks like:
b = [[0, 0.5, 1, 1.5, 2]
[0, 1, 2, 3, 4]
[0, 1.5, 3, 4.5, 6]]
This is my code:
import numpy as np
a = np.arange(1001)
c = np.vectorize(np.linspace)(0, a, 101)
print(c)
It shows that: ValueError: setting an array element with a sequence. Is there any method to do this in numpy without for loop?