Numpy给矩阵元素统一赋值
import numpy as np
T = np.full((6, 6),3)
print(T)
python线性回归
from scipy import stats
def fun_regression(x,y):
r= stats.linregress(x,y)
k,b=r.slope,r.intercept
return k,b
产生高斯分布
import numpy as np
import matplotlib.pyplot as plt
sampleNo=1000
mu=1.207052214
sigma=0.147129166
#标准差
np.random.seed(1)
s=np.random.normal(mu,sigma,sampleNo)