# welcome to softhunt.net
# Python program explaining
# numpy.unpackbits() function
# importing numpy
import numpy as np
# creating input array using
# array function
arr = np.array([122, 15], dtype = np.uint8)
print ("Input array : ", arr)
# unpacking elements of an array
# using unpackbits() function
ans = np.unpackbits(arr)
print ("Output unpacked array : ", ans)
# welcome to softhunt.net
# Python program explaining
# numpy.unpackbits() function
# importing numpy
import numpy as np
# creating input array using
# array function
arr = np.array([[122, 15],[ 34, 12]], dtype = np.uint8)
print ("Input array : ", arr)
# unpacking elements of an array
# using unpackbits() function
ans = np.unpackbits(arr, axis=0)
print ("Output unpacked array :
", ans)
# welcome to softhunt.net
# Python program explaining
# numpy.unpackbits() function
# importing numpy
import numpy as np
# creating input array using
# array function
arr = np.array([[122, 15],[ 34, 12]], dtype = np.uint8)
print ("Input array : ", arr)
# unpacking elements of an array
# using unpackbits() function
ans = np.unpackbits(arr, axis=1)
print ("Output unpacked array :
", ans)