Q:

Write a NumPy program to remove single-dimensional entries from a specified shape. Specified shape: (3, 1, 4)

0

Write a NumPy program to remove single-dimensional entries from a specified shape.
Specified shape: (3, 1, 4).

All Answers

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

import numpy as np
x = np.zeros((3, 1, 4))
print(np.squeeze(x).shape)

Sample Output:

(3, 4)

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