- 博客(10)
- 收藏
- 关注
原创 Python实现线性回归
from sklearn.datasets import load_bostonfrom sklearn.linear_model import LinearRegression,SGDRegressorfrom sklearn.model_selection import train_test_splitfrom sklearn.preprocessing import StandardScalerfrom sklearn.metrics import mean_squared_errorde
2021-07-30 18:30:07 91
原创 数据划分代码
rom sklearn.datasets import load_iris,fetch_20newsgroupsfrom sklearn.model_selection import train_test_splitli=load_iris()#print("特征值")#print(li.data)#print("目标值")#print(li.target)#print("描述")#print(li.DESCR)x_train,x_test,y_train,y_test=train_te
2021-05-30 11:47:33 123
原创 911数据分析
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: page148_2.py@time: 2021/05/02@desc:"""import pandas as pdimport numpy as npfrom matplotlib import pyplot as pltpd.set_option('display.max_columns', 50)pd.set_option('display.max_
2021-05-02 14:47:22 318
原创 计算城市的星巴克数量
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: page140_2.py@time: 2021/04/18@desc:"""import pandas as pdimport numpy as pyfrom matplotlib import pyplot as pltfile_path="./starbucks_store_worldwide.csv"df=pd.read_csv(file_path
2021-04-18 17:46:35 143
原创 Pandas去读数据及绘图
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: page124.py@time: 2021/04/14@desc:"""import pandas as pdfrom matplotlib import pyplot as pltfile_path="./datasets_IMDB-Movie-Data.csv"df=pd.read_csv(file_path)#print(df.head(1))#
2021-04-14 20:37:13 169
原创 ndarry缺失值填充均值
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: page87.py@time: 2021/04/10@desc:"""import numpy as npdef fill_ndarray(t1): for i in range(t1.shape[1]): #遍历每一列 tem_col=t1[:i] #当前的一列 nan_num=np.count_nonzero(t
2021-04-10 18:19:14 270
原创 python绘制直方图
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: page48.py@time: 2021/04/06@desc:"""from matplotlib import pyplot as pltinterval = [0,5,10,15,20,25,30,35,40,45,60,90]width = [5,5,5,5,5,5,5,5,5,15,30,60]quantity = [836,2737,3723,
2021-04-06 21:15:03 145
原创 递归打印目录
#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: tree.py@time: 2021/04/03@desc:"""#递归打印所有的目录和文件import osallfiles=[]def getAllFiles(path,level): childFiles=os.listdir(path) for file in childFiles: filepath=os.path
2021-04-03 20:01:45 66
原创 单例模式作业
下面展示一些 `内联代码片`。#!usr/bin/env python# -*- coding:utf-8 -*-"""@author: 86151@file: factory_single.py@time: 2021/03/21@desc:"""#测试工厂模式和单例模式的整合使用class CarFactory: __obj = None # 类属性 __init_flag = True def create_car(self,brand):
2021-03-21 14:43:09 79
原创 作业
作业欢迎使用Markdown编辑器新的改变功能快捷键合理的创建标题,有助于目录的生成如何改变文本的样式插入链接与图片如何插入一段漂亮的代码片生成一个适合你的列表创建一个表格设定内容居中、居左、居右SmartyPants创建一个自定义列表如何创建一个注脚注释也是必不可少的KaTeX数学公式新的甘特图功能,丰富你的文章UML 图表FLowchart流程图导出与导入导出导入#测试可调用方法__call__()class SalaryAccount():def call(self,salary):print
2021-03-20 19:34:07 87
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人