Numpy基础操作

创建数组对象:

1.numpy.array([[list],[list]])   //返回多维矩阵

2.numpy.arrange(start,stop,step,dtype)  //返回一维数组,start默认为0,步长默认为1

3.numpy.zeros(shape)  //返回多维矩阵,元素值为0

4.numpy.eye(m,n,k,dtype)  //返回一个m*n多维矩阵,其中对角线元素为1,其余为0

随机数类:

5.numpy.random.random(shape)  //返回无条件随机数矩阵

6.numpy.random.rand(shape)  //生成服从均匀分布的随机数矩阵

7.numpy.random.randn(shape)  //生成服从正态分布的随机数矩阵

8.numpy.random.randint(low,up,shape)  //生成给定上下界的随机数矩阵

索引:

1.arr[行:列]

2.arr[行1,行2:列1,列2] //范围索引

重构:

numpy.reshape(shape) 

numpy.ravel()  //矩阵展平

numpy.hstack(arr1,arr2)  //数组横向组合

numpy.vstack(arr1,arr2)  //数组纵向组合

math运算:

Numpy基础操作_第1张图片

 

你可能感兴趣的:(python学习笔记,大数据,python)