I need to create something like:
x1 = [1 1 1]
x2 = [2 2 2]
.
.
.
xn = [n n n]
and for this, I was thinking of doing:
for i in range(whatever):
xi = np.array([i, i, i])
but it doesn't work, obviously. pleasy help me!
x = [np.array([i, i, i]) for i in range(whatever)]
Now x is a nested list and your xi corresponds to x[i]
I think you cannot use dynamic variable names in python, but you still can have dynamic dictionary keys. You can use a dictionary to achieve something like this:
data = {}
for i in range(100):
data['x'+str(i)] = np.array([i, i, i])
Or use the comprehension method
data = {'x{}'.format(i): np.array([i, i, i]) for i in range(100)}
Or using lists:
data = [np.array([i, i, i]) for i in range(100)]