摘要:
import numpy as np a=np.array([1,2 ,3, 4]) print(len(a)) b=np.array([[ 1000, 100, 10, 1], [35, 9, 1, 5], [22, 12, 3, 2]]) print(len(b)) 当是向量时,len函数返回向 阅读全文
摘要:
import numpy as np a=np.array([[ 2, 7, 4, 2], [35, 9, 1, 5], [22, 12, 3, 2]]) print(a) #b=a[np.lexsort(a[:,::-1].T)] #print(b) c=np.array([[1,1,1]]).T 阅读全文
摘要:
import numpy as np a=[] n=1 a=np.hstack((a,n)) n=2 a=np.hstack((a,n)) print(a) b=np.empty((0,1),int) n=1 b=np.vstack((b,n)) n=2 b=np.vstack((b,n)) pri 阅读全文
摘要:
import numpy as np x=[1,2,3,4] min1=min(x) max1=max(x) print(min1) print(max1) y=np.array([5, 6, 7, 8]) min2=min(y) max2=max(y) print(min2) print(max2 阅读全文
摘要:
import numpy as npa1=np.array([1000, 100, 10, 1])a2 = np.array([[1000], [100], [10], [1]])#a2=np.array([[1000, 100, 10, 1]]).Ta3=np.array([[ 1000, 100 阅读全文
摘要:
import numpy as np a=np.array([[ 1000, 100, 10, 1], [35, 9, 1, 5], [22, 12, 3, 2]]) b=np.log10(a) print(b) 结果为 阅读全文
摘要:
import matplotlib.pyplot as plt import numpy as np x = np.arange(0, 2*np.pi, 0.02) y = np.sin(x) y1 = np.sin(2*x) y2 = np.sin(3*x) ym1 = np.ma.masked_ 阅读全文
摘要:
我输入一个浮点数float好比10.0,我希望将其转化为整形int10,但是输入浮点数10.1的时候,结果仍然保持为浮点数10.1 当输入为10的时候 a=10.0 if int(a)==a: b=int(a) else: b=a print(b) 运行结果 当输入为10.1的时候 a=10.1 i 阅读全文
摘要:
这是我的数据库student,好比输入一个值为32,查询id最接近32的整行数据,可以用以下代码 import pymysql value=32 conn = pymysql.connect(host='39.106.168.84', user='xxxxxxx', password='xxxxxx 阅读全文