码迷,mamicode.com
首页 > 编程语言 > 详细

[Python] Array Attributes of Numpy lib

时间:2017-12-18 01:21:47      阅读:127      评论:0      收藏:0      [点我收藏+]

标签:5*   ted   blog   ocs   code   gen   post   __name__   pytho   

Attributes of numpy.ndarray:

import numpy as np 

def array():
    a = np.random.random((5,4))
    print(a.shape[0]) #number of rows, 5
    print(a.shape[1]) #number of columns, 4
    print(len(a.shape)) #2
    print(a.size) # 5*4=20
    print(a.dtype) #float64

if __name__ == "__main__":
    #gen_random() 
    array()   

 

[Python] Array Attributes of Numpy lib

标签:5*   ted   blog   ocs   code   gen   post   __name__   pytho   

原文地址:http://www.cnblogs.com/Answer1215/p/8053904.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!