Numpy-- Numeric python :是python 的一种开源数值计算扩展。
1. 一个强大的N维数组;
2.比较成熟的(广播)函数库;
3. 用于整合c/c++ 和 Fortrant代码的工具包;
4.实用 的线性代表,傅里叶变换和随机数生成函数;
5.Numpy 和稀疏矩阵运算scipy 配合使用更加强大;
使用 Numpy.array() 由python list 创建
注意:* numpy默认ndarrey 的所有元素类型是相同的;
* 如果传进来的列表中包含不同的类型,则统一为同一类型,优先级:str>float > int
1. 使用np.array(Python list)
n1 = np.array( [1,2,3,4] )
2, 使用 routines 创建
1) np.ones( shape , dtype=None , order = "c")
np.ones((3,4),dtype = str)
array([['1', '1', '1', '1'],
['1', '1', '1', '1'], ['1', '1', '1', '1']], dtype='<U1')
2 ) np.zeros(shape , dtypt=None , order =