摘要: 1.数据探索 1.1数据描述统计以及相关系数分析 import numpy as np import pandas as pd inputfile = 'data.csv' #输入的数据文件 data = pd.read_csv(inputfile) #读取数据 r = [data.min(), d 阅读全文
posted @ 2022-04-01 23:41 猪小叶 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 一、神经网络 import pandas as pd from keras.models import Sequential from keras.layers.core import Dense, Activation # 参数初始化 inputfile = 'bankloan.xls' data 阅读全文
posted @ 2022-03-27 00:06 猪小叶 阅读(146) 评论(0) 推荐(0) 编辑
摘要: import profile import random from fractions import Fraction #四则运算 def szys(): sym = ['+', '-', '×', '÷'] f= random.randint(0, 3) z = random.randint(0, 阅读全文
posted @ 2021-09-19 20:04 猪小叶 阅读(54) 评论(0) 推荐(0) 编辑
摘要: #四则运算 import profile import random def szys(): yunsuan = ["+","-","*","/"] f= random.randint(0, 3) n1 = random.randint(1, 20) n2 = random.randint(1, 2 阅读全文
posted @ 2021-09-19 19:58 猪小叶 阅读(26) 评论(0) 推荐(0) 编辑
摘要: python操作数据库读书笔记 使用 1、导入python SQLITE数据库模块 import sqlite3 2、打开数据库 在调用connect函数的时候,指定库名称,如果指定的数据库存在就直接打开这个数据库,如果不存在就新创建一个再打开。 cx=sqlite3.connect("E:/tes 阅读全文
posted @ 2020-05-27 17:24 猪小叶 阅读(127) 评论(0) 推荐(0) 编辑
摘要: 预测乒乓球比赛 from random import random def printIntro(): print("学号信息:41号") print("这个程序模拟两个选手A和B的乒乓球比赛") print("程序运行需要A和B的能力值(以0到1之间的小数表示)") print("一局比赛:在一局 阅读全文
posted @ 2020-05-20 16:14 猪小叶 阅读(80) 评论(0) 推荐(0) 编辑
摘要: 一: 用requests 多次访问百度主页内容,打印返回状态,text内容,计算text属性和cotent属性所返回网页内容的长度 import requests r=requests.get("http://www.baidu.com") r.encoding="UTF-8" for i in r 阅读全文
posted @ 2020-05-13 16:19 猪小叶 阅读(158) 评论(0) 推荐(0) 编辑
摘要: numpy库函数基本使用 import numpy as np 1、创建数组的函数(ndarray) 2、ndarray类型的常用属性 3、ndarray类型的型态操作方法 4、ndarray 类型的索引与切片方法 5、ndarray类型的算术运算函数 6、ndarray类型的比较运算函数 7、nd 阅读全文
posted @ 2020-05-06 17:37 猪小叶 阅读(151) 评论(0) 推荐(0) 编辑
摘要: 汉诺塔 def hlt(A,B,C,n): if n==1: print(A,'-->',C) else: hlt(A,C,B,n-1) print(A,'-->',C) hlt(B,A,C,n-1) n=eval(input()) hlt('A','B','C',n) 阅读全文
posted @ 2020-04-07 16:31 猪小叶 阅读(89) 评论(0) 推荐(0) 编辑
摘要: 带有进度条圆周率计算 from math import* import time n=10 pi=0.0 print(" 执行开始 ") start=time.perf_counter() for k in range(n+1): pi+=1/pow(16,k)*(4/(8*k+1)-2/(8*k+ 阅读全文
posted @ 2020-03-22 16:43 猪小叶 阅读(200) 评论(0) 推荐(0) 编辑