📜  numpy.matlib.empty()函数| Python

📅  最后修改于: 2022-05-13 01:54:59.899000             🧑  作者: Mango

numpy.matlib.empty()函数| Python

numpy.matlib.empty()函数返回给定形状和类型的新矩阵,而不初始化条目。

代码#1:

# Python program explaining
# numpy.matlib.empty() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
# filled with random data
gfg = geek.matlib.empty((2, 2))
  
# output will be random
print (gfg)

输出 :

[[  6.91957648e-310   1.90383493e-316]
 [  6.91957669e-310   5.30409905e-317]]


代码#2:

# Python program explaining
# numpy.matlib.empty() function
  
# importing numpy as geek 
# and importing matlib module  
import numpy as geek
import numpy.matlib
  
# filled with random data
gfg = geek.matlib.empty((2, 2), dtype = int)
  
# output will be random
print (gfg)

输出 :

[[139855860099992        40294208]
 [139855825297024        10730496]]