主页:http://numeric.scipy.org
相关模块:Numeric, Numarray
建议导入方法
1 import numpy
然后就可以在 numpy 名字空间内使用它自带的各个子模块
NumPy包含的子模块
Contents
NumPy 提供了两个基本对象: N-维矩阵对象(ndarray)和通用函数对象(ufunc)。其他的对象都是建立在这两个对象之上的。
注意:矩阵元素的索引从0开始,到n-1结束,这是为了与Python中的其他对象兼容而做
定义2x3整型矩阵,每个元素占有4个字节(32-bit平台)。通过方括号进行元素索引。
1 >>> a = numpy.array([[1,2,3],[4,5,6]]) 2 >>> a 3 array([[1, 2, 3], 4 [4, 5, 6]]) 5 >>> a.shape 6 (2, 3) 7 >>> a.dtype 8 dtype('<i4') 9 >>> a[1,1] 10 5
NumPy (last edited 2009-12-25 07:14:49 by localhost)