摘要: 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函数返回向 阅读全文
posted @ 2020-06-05 21:38 青女素娥 阅读(1907) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-06-05 20:47 青女素娥 阅读(26793) 评论(0) 推荐(1) 编辑
摘要: 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 阅读全文
posted @ 2020-06-05 20:13 青女素娥 阅读(3569) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-06-05 19:26 青女素娥 阅读(917) 评论(0) 推荐(0) 编辑
摘要: 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 阅读全文
posted @ 2020-06-05 19:11 青女素娥 阅读(2381) 评论(0) 推荐(0) 编辑
摘要: 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) 结果为 阅读全文
posted @ 2020-06-05 18:41 青女素娥 阅读(792) 评论(0) 推荐(0) 编辑
摘要: 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_ 阅读全文
posted @ 2020-06-05 18:38 青女素娥 阅读(2173) 评论(0) 推荐(0) 编辑
摘要: 我输入一个浮点数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 阅读全文
posted @ 2020-06-05 18:15 青女素娥 阅读(440) 评论(0) 推荐(0) 编辑
摘要: 这是我的数据库student,好比输入一个值为32,查询id最接近32的整行数据,可以用以下代码 import pymysql value=32 conn = pymysql.connect(host='39.106.168.84', user='xxxxxxx', password='xxxxxx 阅读全文
posted @ 2020-06-05 18:02 青女素娥 阅读(974) 评论(0) 推荐(0) 编辑
摘要: 数据库如图 我们在web输入一行信息,如图 插入数据库,如图 可以看到,这行信息已经插入了,然后我们将新插入的这行信息显示到web页面 整个流程就是这样,代码如下: sqlinputweb.py from flask import Flask, render_template, request im 阅读全文
posted @ 2020-05-31 17:40 青女素娥 阅读(3915) 评论(0) 推荐(0) 编辑