Answers for "copy along additional dimension numpy"

0

copy along additional dimension numpy

a = np.array([[1,2],[1,2]])
b = np.repeat(a[:, :, np.newaxis], 3, axis=2)
print(b[:, :, 0])
# [[1 2]
#  [1 2]]

print(b[:, :, 1])
# [[1 2]
#  [1 2]]

print(b[:, :, 2])
# [[1 2]
#  [1 2]]
Posted by: Guest on March-21-2021

Code answers related to "copy along additional dimension numpy"

Python Answers by Framework

Browse Popular Code Answers by Language