摘要:
点击查看代码 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, 阅读全文
摘要:
点击查看代码 import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # 定义参数u和v u = np.linspace(-2, 2, 400) v = np.linspac 阅读全文
摘要:
点击查看代码 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' fo 阅读全文
摘要:
点击查看代码 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), ind 阅读全文
摘要:
点击查看代码 import numpy as np a = np.eye(4) b = np.rot90(a) c, d = np.linalg.eig(b) print('特征值为:', c) print('特征向量为:\n', d) print("学号:2023310143004") 阅读全文
摘要:
点击查看代码 import numpy as np a = np.ones(4) b = np.arange(2, 10, 2) c = a @ b #a作为行向量,b作为列向量 d = np.arange(16).reshape(4,4) f = a @ d #a作为行向量 g = d @ a # 阅读全文