摘要: 1.机器学习步骤(254:45) (1)import the data - csv文件 (2)clean the data - 删除重复、不完整数据等 (3)split the data into training/ test sets (4)create a model - 决策树、神经网络等 ( 阅读全文
posted @ 2020-01-06 22:32 昨天也没吃饭 阅读(119) 评论(0) 推荐(0)
摘要: 1.处理excel表格 问题描述:图中的excel表格价格有误,需要将价格打9折;同时制一张图(当有多个excel表时,用python处理较快) import openpyxl as xl from openpyxl.chart import BarChart, Reference def proc 阅读全文
posted @ 2020-01-02 23:09 昨天也没吃饭 阅读(186) 评论(0) 推荐(0)
摘要: 1.用python内置包生成1-6 的随机数元组 import random class Dice: def roll(self): x = random.randint(1,6) y = random.randint(1,6) return x,y#python会自动默认为一个元组 dice = 阅读全文
posted @ 2020-01-01 23:17 昨天也没吃饭 阅读(110) 评论(0) 推荐(0)
摘要: 1.try except 语句(179:22) 避免因一些错误导致的程序崩溃 try: age = int (input("Age: ")) income = 20000 risk = income / age print(age) except ZeroDivisionError: print(' 阅读全文
posted @ 2019-12-31 21:28 昨天也没吃饭 阅读(137) 评论(0) 推荐(0)
摘要: 1.元组 numbers = (1,2,3) 元组里面的项目不可以修改(用圆括号) 2.解压缩 coordinates = (1,2,3) x,y,z = coordinates print(x,y,z) >>1 2 3 3.字典 customer = { "name" : "John smith" 阅读全文
posted @ 2019-12-27 23:23 昨天也没吃饭 阅读(83) 评论(0) 推荐(0)
摘要: 1.用双层循环语句输出一个F numbers = [5,2,5,2,2] for item in numbers: output = '' for count in range(item): output += "x" print(output) 2.寻找列表中最大的数 numbers = [3,6 阅读全文
posted @ 2019-12-26 22:47 昨天也没吃饭 阅读(142) 评论(0) 推荐(0)
摘要: 1.案例 1.猜数字3次,检验是否与提前设置的secret_number一致 guess_count = 0 guess_limit = 3secret_number = 9 while guess_count < guess_limit: guess = int ( input ( 'Guess: 阅读全文
posted @ 2019-12-25 22:03 昨天也没吃饭 阅读(282) 评论(0) 推荐(0)
摘要: 1.算术运算 + - * / // —— 结果取整 % ——取余 ** —— 幂 2.数学函数 round()—— 四舍五入 abs()——绝对值 import math ——引入math模块 https://www.cnblogs.com/MingleYuan/p/10628503.html 3. 阅读全文
posted @ 2019-12-24 21:15 昨天也没吃饭 阅读(469) 评论(0) 推荐(0)