线性回归与逻辑回归

线性回归(boston房价预测)

(1)数据预处理
1
2
3
4
5
6
7
8
9
data = pd.read_csv("data.txt", delim_whitespace=True, names=['CRIM', 'ZN', 'INDUS','CHAS',' NOX','RM','AGE',' DIS',' RAD',' TAX','PTRATIO','B','LSTAT','MEDV'])

for i in range(len(data)):
if((i + 1) % 2 != 1):
data["B"][i - 1] = data["CRIM"][i]
data["LSTAT"][i - 1] = data["ZN"][i]
data["MEDV"][i - 1] = data["INDUS"][i]
data = data.drop([i], axis = 0)
data # 查看数据

Python

一.基础语法

注意:python使用时需要严格缩进,否则在执行是会出现报错

1.注释

1
# 这里是一个注释嗷!

2.打印

1
print ('hello word!')
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×