https://www.udemy.com/course/ds_for_python/ Je vais oublier la commande pendant que je fais
import
import numpy as np
flatten()
flatten
array1=np.array([[1,2,3],[4,5,6],[7,8,9]])
array1.flatten()
array([1, 2, 3, 4, 5, 6, 7, 8, 9])
squeeze
squeeze
array1=np.array([[1,2,3]])
array1.shape
(1, 3)
squeeze
np.squeeze(array1)
(3,)
Réduisez la dimension.
expand_dims
expand_dims
ndarray1=np.array([1,2,3])
ndarray1.shape
expand_axis=np.expand_dims(ndarray1, axis=-1)
expand_axis.shape
expand_axis
(3,)
(3, 1)
array([[1],
[2],
[3]])
Au contraire, augmentez la dimension. L'endroit où augmenter les changements avec l'argument «axe».
Recommended Posts