摘要:
`from scipy.integrate import quad def fun42(x, a, b): return ax**2+bx I1 = quad(fun42, 0, 1, args=(2, 1)) I2 = quad(fun42, 0, 1, args=(2, 10)) print(I 阅读全文
摘要:
`from scipy.optimize import fsolve, root fx = lambda x: [x[0]2+x[1]2-1, x[0]-x[1]] s1 = fsolve(fx, [1, 1]) s2 = root(fx, [1, 1]) print(s1,'\n',' '); p 阅读全文
摘要:
`from scipy.optimize import fsolve, root fx = lambda x: x980-5.01*x979+7.398x**978 -3.388x977-x3+5.01x**2-7.398x+3.388 x1 = fsolve(fx, 1.5, maxfev=400 阅读全文
摘要:
`import numpy as np a=np.random.rand(6,8) #生成6×8的[0,1)上均匀分布的随机数矩阵 np.savetxt("data2_43_1.txt", a) #存成以制表符分隔的文本文件 np.savetxt("data2_43_2.csv", a, delim 阅读全文
摘要:
`import pandas as pd import numpy as np a = pd.DataFrame(np.random.randint(1,6,(5,3)), index=['a', 'b', 'c', 'd', 'e'], columns=['one', 'two', 'three' 阅读全文
摘要:
`import pandas as pd import numpy as np d=pd.DataFrame(np.random.randint(1,6,(10,4)), columns=list("ABCD")) d1=d[:4] #获取前4行数据 d2=d[4:] #获取第5行以后的数据 dd= 阅读全文
摘要:
`with open('data2_2.txt') as fp: L1=[]; L2=[]; for line in fp: L1.append(len(line)) L2.append(len(line.strip())) #去掉换行符 data = [str(num)+'\t' for num 阅读全文
摘要:
`import pandas as pd a=pd.read_csv("data2_38_2.csv", usecols=range(1,5)) b=pd.read_excel("data2_38_3.xlsx", "Sheet2", usecols=range(1,5)) print("学号:30 阅读全文
摘要:
2.38.1 `import pandas as pd import numpy as np dates=pd.date_range(start='20191101', end='20191124', freq='D') a1=pd.DataFrame(np.random.randn(24,4), 阅读全文
摘要:
`import pandas as pd import numpy as np dates=pd.date_range(start='20191101',end='20191124',freq='D') a1=pd.DataFrame(np.random.randn(24,4), index=dat 阅读全文