“Reshape (-1,1)” Kod odpowiedzi

NP.Reshape ()

a = np.arange(6).reshape((3, 2))
>>> a
array([[0, 1],
       [2, 3],
       [4, 5]])
Careful Caterpillar

Reshape (-1,1)

np_scaled = scaler.fit_transform(data.values.reshape(-1,1))
Juan Rubiales

Reshape (n) do (n 1)

'''
This code is contributed by :
Tanishq Vyas (github : https://github.com/tanishqvyas )
'''

actual = actual.reshape((actual.shape[0], 1))
Tanishq Vyas

przefasonować

# Python Program illustrating
# numpy.reshape() method
 
import numpy as geek
 
# array = geek.arrange(8)
# The 'numpy' module has no attribute 'arrange'
array1 = geek.arange(8)
print("Original array : \n", array1)
 
# shape array with 2 rows and 4 columns
array2 = geek.arange(8).reshape(-1, 1)
print("\narray reshaped with 2 rows and 4 columns : \n",
      array2)
 
# shape array with 4 rows and 2 columns
array3 = geek.arange(8).reshape(4, 2)
print("\narray reshaped with 2 rows and 4 columns : \n",
      array3)
 
# Constructs 3D array
array4 = geek.arange(8).reshape(2, 2, 2)
print("\nOriginal array reshaped to 3D : \n",
      array4)
MALESELA MARCUS

.Reshape (-1,1)

z.reshape(-1,1)
array([[ 1],
   [ 2],
   [ 3],
   [ 4],
   [ 5],
   [ 6],
   [ 7],
   [ 8],
   [ 9],
   [10],
   [11],
   [12]])
Vast Vendace

Odpowiedzi podobne do “Reshape (-1,1)”

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu