xxxxxxxxxx
# welcome to softhunt.net
# import numpy
import numpy as np
# using Numpy.expand_dims() function
softhunt = np.array([[1, 2], [7, 8]])
print(softhunt.shape)
softhunt = np.expand_dims(softhunt, axis = 1)
print(softhunt.shape)
xxxxxxxxxx
import numpy as np
# Create a sample 1-dimensional NumPy array
arr = np.array([1, 2, 3, 4, 5])
# Expand the dimensions of the array along axis 0
expanded_arr = np.expand_dims(arr, axis=0)
print(expanded_arr)
xxxxxxxxxx
# welcome to softhunt.net
# import numpy
import numpy as np
# using Numpy.expand_dims() function
softhunt = np.array([1, 2])
print(softhunt.shape)
softhunt = np.expand_dims(softhunt, axis = 0)
print(softhunt.shape)