Q:

Write a NumPy program to remove the first dimension from a given array of shape (1,3,4)

0

Write a NumPy program to remove the first dimension from a given array of shape (1,3,4).

Sample array:
[[[1, 2, 3, 4],
[0, 1, 3, 4],
[5, 0, 3, 2]]])

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

import numpy as np
nums = np.array([[[1, 2, 3, 4],
               [0, 1, 3, 4],
               [5, 0, 3, 2]]])
print('Shape of the said array:')
print(nums.shape) 
print("\nAfter removing the first dimension of the shape of the said array:")

Sample Output:

Shape of the said array:
(1, 3, 4)

After removing the first dimension of the shape of the said array:

 

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now