![](https://img-blog.csdnimg.cn/20201014180756738.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
numpy使用
介绍一些numpy常见用法
SumFunction
这个作者很懒,什么都没留下…
展开
-
numpy使用3
numpy使用3 矩阵相关应用 import numpy as np test1 = np.array([[1,2,3],[4,5,6],[7,8,9]]) print(np.linalg.inv(test1))#求逆 求伪逆是pinv print(np.mean(test1,axis=0))#按行求均值 axis=1按列求均值 print(np.sum(test1,axis=0))#按行求和 结果: [[-4.50359963e+15 9.00719925e+15 -4.50359963e+15] [原创 2021-02-28 20:50:46 · 53 阅读 · 0 评论 -
numpy使用2
numpy使用2 numpy插入 参数说明 第一个 插入对象 第二个 values 插入值 第三个 axis=0是按行插入 =1是按列插入 第四个 obj 插入在什么位置 import numpy as np #无维度的numpy插入 test1 = np.array([1,2,3]) test2 = np.array([4,5,6]) y = np.insert(test1,values=test2,axis=0,obj=1) print(y) 输出结果: [1 4 5 6 2 3] 可以看出 列表型的原创 2021-02-28 20:38:44 · 116 阅读 · 2 评论 -
numpy使用1
numpy使用1 numpy数组的创建 import numpy test1 = numpy.array([1,2,3])#这个不含维度 test2 = numpy.array([[1,2,3]])#这个含大小 shape为(1,3) test3 = numpy.array([[1,2,3],[4,5,6]]) print(test1)#无shape print(test2)#shape为(1,3) print(test3)#shape为(2,3) ...原创 2021-02-28 18:23:50 · 165 阅读 · 2 评论