摘要: import matplotlib.pyplot as plt plt.figure(1) plt.figure(figsize=(10,40)) plt.subplot(411) plt.plot([1,2,3,4], [1,2,3,4]) plt.subplot(412) plt.plot([1 阅读全文
posted @ 2020-06-17 04:09 青女素娥 阅读(4331) 评论(0) 推荐(0) 编辑
摘要: import numpy as np import pymysql Pa=101325#Pa 大气压力input Ta=30#摄氏度 介质温度input Q=270000#m3/h 设计流量input P=4200#Pa 设计压力input n=1000#rp/min 输入转速input chdon 阅读全文
posted @ 2020-06-11 02:30 青女素娥 阅读(1315) 评论(0) 推荐(0) 编辑
摘要: from decimal import Decimal r = "ab.999999999" #r = "19.999999999" #if r.isdigit()==1 or "".join(r.strip("+").strip("-").split(".")).isdigit()==1: if 阅读全文
posted @ 2020-06-09 04:48 青女素娥 阅读(723) 评论(0) 推荐(0) 编辑
摘要: 程序是连起来的,为了结果方便观察,我把程序分为几段发 import numpy as np import pandas as pd a=np.full((3, 1), 'no exist') df = pd.DataFrame([['A', 2], ['A', 4], ['B', 6]]) prin 阅读全文
posted @ 2020-06-09 01:37 青女素娥 阅读(707) 评论(0) 推荐(0) 编辑
摘要: import numpy as np a=np.array([1,0,0,0]) if a.any()==0: print('all is 0') else:print('exist not 0') a=np.array([0,0,0,0]) if a.any()==0: print('all is 阅读全文
posted @ 2020-06-09 01:26 青女素娥 阅读(19310) 评论(0) 推荐(0) 编辑
摘要: a1=3b1=4c1=a1+b1print(c1)a2=str(a1)b2=str(b1)c2=a2+b2print(c2)a3='a'b3='b'c3=a3+b3print(c3) 可以看到变量的类型 运行结果 阅读全文
posted @ 2020-06-07 17:30 青女素娥 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 输入为行向量 import numpy as np a=np.array([ 1 ,2 ,3 ,4,5,6,7,8,9,10]) b=a[0::2] b=b.reshape(-1, 1) print(b) c=a[1::2] c=c.reshape(-1, 1) print(c) d=np.hsta 阅读全文
posted @ 2020-06-06 05:32 青女素娥 阅读(1171) 评论(0) 推荐(0) 编辑
摘要: n = 5 lists = [[] for _ in range(n)] lists[0]=[1,2,3] lists[1]=[4,5] print(lists) 阅读全文
posted @ 2020-06-06 04:23 青女素娥 阅读(10603) 评论(0) 推荐(1) 编辑
摘要: 我的数据库如图 结构 我取了其中的name age nr,做成array,只要所取数据存在str型,那么取出的数据,全部转化为str型,也就是array阵列的元素全是str,不管数据库定义的是不是int型。 那么问题来了,取出的数据代入公式进行计算的时候,就会类型不符,这是就用到astype(np. 阅读全文
posted @ 2020-06-05 22:07 青女素娥 阅读(10316) 评论(0) 推荐(0) 编辑
摘要: import numpy as npa=[4,5,6,7,8]a=np.array(a)D2=5.5b=abs(a-D2)bmin=min(b)index=np.where(b==bmin)c=a[index]d=max(c)print(d) 向量是a,输入的特定是D2是5.5,向量里最接近5.5的 阅读全文
posted @ 2020-06-05 21:45 青女素娥 阅读(403) 评论(0) 推荐(0) 编辑