![](https://img-blog.csdnimg.cn/20201014180756916.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
Numpy
huahuahuahhhh
一步一步,慢慢来
展开
-
numpy保存和加载数据
numpy保存和加载数据原创 2022-08-10 11:40:35 · 1420 阅读 · 0 评论 -
numpy求定积分
参考https://blog.csdn.net/god_yutaixin/article/details/103657208import numpy as npimport scipy.integrate as si #numpy求定积分用def f(x): y = 1/np.sqrt(2*np.pi)*np.exp(-0.5*x**2) return y#3. numpy直接求定积分的API#利用quad求定积分,给出函数f,积分下限和积分上限[a,b],返回值为(积分值,最原创 2022-04-22 10:19:45 · 5025 阅读 · 0 评论 -
NumPy 高级索引
参考菜鸟教程1. 一维数组索引import numpy as npa = np.array([1,2,3])b = np.array([1,2,0,0,1,2,0])c = a[b]print('c',c.shape,c)输出c (7,) [2 3 1 1 2 3 1]a[b]等价于遍历b中的元素,作为索引值,取a中索引位置的值。结果与b的长度相同c = []for i in b: c.append(a[i])2. 二维数组索引3. ...和:索引...原创 2021-08-05 18:33:11 · 159 阅读 · 0 评论 -
numpy中的broadcasting
Broadcasting 官方文档参考文档广播机制应用:numpy.array与scalar将scalar扩充成array的形状后,进行操作一般arrays间的广播机制从最后边的维度开始匹配,当满足下面两个条件的任意一个时,两个数组间是兼容的:维度相等有一个的维度为1.如果上述两个条件无法满足,则会抛出ValueError: operands could not be broadcast together exception is thrown下面的例子中,A和B阵列都具有原创 2021-08-04 14:47:38 · 155 阅读 · 0 评论 -
numpy中的加法
import numpy as npm = 4n = 2y, x = np.ogrid[:m, :n]sigma = 1.0print(y)print(x)print(x+y)x (1,2)y (4,1)x+y (4,2)长见识了原创 2021-06-27 18:33:04 · 1004 阅读 · 0 评论 -
numpy中数组维度的理解
这篇文章主要是为了弄清楚数组按每个维度进行计算时,具体的操作是什么样的。一、数组中的各个维度表示的是什么?为了便于理解,用最小单位体表示,剥去最外面一层中括号后,数据的形状。1. 以二维数组为例import numpy as npnp.random.seed(0)arr2 = np.random.randint(0,9,size=(4,3))print(arr2)[[5 0 3]...原创 2020-02-20 16:09:47 · 9841 阅读 · 8 评论 -
Numpy中stack(),hstack(),vstack()函数详解
https://blog.csdn.net/csdn15698845876/article/details/73380803/转载 2020-01-17 17:21:48 · 171 阅读 · 0 评论 -
np.meshgrid
np.meshgridx:array([ 0. , 0.25, 0.5 , 0.75, 1. ])y:array([ 0. , 0.5, 1. ])x,y = np.meshgrid(x,y)原创 2019-10-28 10:58:24 · 544 阅读 · 0 评论