Ejemplo 1: remodelar (n) a (n 1)
'''
This code is contributed by :
Tanishq Vyas (github : https://github.com/tanishqvyas )
'''
actual = actual.reshape((actual.shape[0], 1))
Ejemplo 2: convertir np forma (a,) a (a, 1)
# numpy array/vector (n,) dimension -> (n,1) dimension conversion
a = np.arange(3) # a.shape = (3,)
b = a.reshape((3,1)) # b.shape = (3,1)
c = b.reshape((3,)) # c.shape = (3,)
c2 = b.reshape((-1,1)) # c2.shape = (3,)
¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)