Suppose I have the following array:
import numpy as np
I = np.array([0, 1, 2, 3, 15, 16, 32, 64, 128])
I would like to convert each item in the array into its binary representation.
Desired output:
[[0 0 0 0 0 0 0 0]
[0 0 0 0 0 0 0 1]
[0 0 0 0 0 0 1 0]
[0 0 0 0 0 0 1 1]
[0 0 0 0 1 1 1 1]
[0 0 0 1 0 0 0 0]
[0 0 1 0 0 0 0 0]
[0 1 0 0 0 0 0 0]
[1 0 0 0 0 0 0 0]]
Whats the most straight forward way to do this? Thanks!