线性回归分析
发布时间
阅读量:
阅读量
线性回归分析
一元线性回归模型构建
代码
城市用水量的预测分析
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from pandas import DataFrame, Series
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
# 读取文件
datafile = u'C:\ Users\ ASUS\ Desktop\ dhdhdh.xlsx' # 文件所在位置,u为防止路径中有中文名称,此处没有,可以省略
data = pd.read_excel(datafile) # datafile是excel文件,所以用read_excel,如果是csv文件则用read_csv
examDf = DataFrame(data)
examDf.head()
# 绘制散点图,examDf.jt为
全部评论 (0)
还没有任何评论哟~
