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

a = np.array( [ [1, 2, 3 ], [4, 5, 6] ] )

print( "a =", a, sep="\n")
print( "a.dtype =", a.dtype ) # 행렬 데이터 타입
print( "a.shape =", a.shape ) # 행렬 구조

print( "-"*40 )
b = np.zeros( (3, 2) ) # 렬 갯수 3, 행 갯수 2의 행렬 생성
print( "np.zeros( (3, 2) )", b, sep="\n")
print( "b.dtype =", b.dtype ) # 행렬 데이터 타입
print( "b.shape =", b.shape ) # 행렬 구조

print( "-"*40 )
c = np.ones( (3, 2) ) # 렬 갯수 3, 행 갯수 2의 행렬 생성
print( "np.ones( (3, 2) )", c, sep="\n")
print( "c.dtype =", c.dtype ) # 행렬 데이터 타입
print( "c.shape =", c.shape ) # 행렬 구조
a =
[[1 2 3]
 [4 5 6]]
a.dtype = int64
a.shape = (2, 3)
----------------------------------------
np.zeros( (3, 2) )
[[0. 0.]
 [0. 0.]
 [0. 0.]]
b.dtype = float64
b.shape = (3, 2)
----------------------------------------
np.ones( (3, 2) )
[[1. 1.]
 [1. 1.]
 [1. 1.]]
c.dtype = float64
c.shape = (3, 2)