So this is what I tried 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 what I was hoping was for example the length is 4. So i create a 4 dimension vector:
vectorized=[0,0,0,0]
now, depending on the index of dictionary (which is also of length 4 in this case) create a vector with value 1 while rest has zero
so vector = [1, 0,0,0] , [0,1,0,0] and so on..
Now instead what is happening is:
vector = [1,0,0,0],[1,1,0,0] .. and finally [1,1,1,1]
even vectorized is now
[1,1,1,1]
Whats wrong I am doing. and how do i achieve what i want to achieve. Basically I am trying to create unit vectors. Thanks