I have a numpy array that is rather large, about 1mill. The distinct number of numbers is about 8 numbered 1-8.
Lets say I want given the number 2, I would like to recode all 2's to 1 and the rest to 0's.
i.e.
2==>1
1345678==0
Is there a pythonic way to do this with numpy?
[1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8]=> [0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0]
Thanks