소스 뷰어
조회수 :   1
import numpy as np 

a = np.arange( 1, 7 ) 

print( "a =", a )
print( "a.shape =", a.shape )
print( "-"*30 )

b = a.reshape( 1, -1 )
print( "b = a.reshape( 1, -1 ) =", b, sep="\n" )
print( "b.shape =", b.shape )
print( "-"*30 )

c = a.reshape( -1, 1 )
print( "a.reshape( -1, 1 )", c, sep="\n" )
print( "c.shape =", c.shape )
print( "-"*30 )

d = a.reshape( 2,3 )
print( "d = a.reshape( 2,3 )", d, sep="\n" )
print( "d.shape =", d.shape )
a = [1 2 3 4 5 6]
a.shape = (6,)
------------------------------
b = a.reshape( 1, -1 ) =
[[1 2 3 4 5 6]]
b.shape = (1, 6)
------------------------------
a.reshape( -1, 1 )
[[1]
 [2]
 [3]
 [4]
 [5]
 [6]]
c.shape = (6, 1)
------------------------------
d = a.reshape( 2,3 )
[[1 2 3]
 [4 5 6]]
d.shape = (2, 3)