So this is what I was trying to do.
vectorized = [0] * length for i,key in enumerate(foo_dict.keys()): vector = vectorized vector[i] = 1 print vector vector = vectorized print vectorized
So I was hoping, for example, the length is 4. So I am creating a 4-dimensional vector:
vectorized=[0,0,0,0]
Now, depending on the index of the dictionary (which in this case also has a length of 4), create a vector with a value of 1, and the remainder will be zero
so vector = [1, 0,0,0] , [0,1,0,0] and so on..
Now, instead, the following happens:
vector = [1,0,0,0],[1,1,0,0] .. and finally [1,1,1,1]
even vectorized now
[1,1,1,1]
What am I doing wrong. and how do I achieve what I want to achieve. I am mainly trying to create unit vectors. Thanks