# welcome to softhunt.net
# Python program explaining
# numpy.packbits() function
# importing numpy
import numpy as np
# creating input array using
# array function
arr = np.array([[[1, 1, 1],[1, 0, 0]],[[0, 1, 0],[0, 0, 1]]])
print ("Input array :
", arr)
# packing elements of an array
# using packbits() function
ans = np.packbits(arr)
print ("Output packed array : ", ans)
# welcome to softhunt.net
# Python program explaining
# numpy.packbits() function
# importing numpy
import numpy as np
# creating input array using
# array function
arr = np.array([[[1, 1, 1],[1, 0, 0]],[[0, 1, 0],[0, 0, 1]]])
print ("Input array :
", arr)
# packing elements of an array
# using packbits() function
ans = np.packbits(arr, axis = 1)
print ("Output packed array :
", ans)