#object: 绘制带回归直线的散点图 #writer: mike #time:2020.11,1 import matplotlib.pyplot as plt import seaborn as sns import pandas as pd data = pd.read_csv("C:\Users\mike1\Desktop\data\zhanglijia\dataExperiment2.csv",header=None,sep=',',names=["x","y",'z']) #print(data.iloc[:10,:]) #注意pandas的切片不同于R,不同于numpy data = data.iloc[0:30,:] #data.iloc[30,:]会认为是第30行 print(data) sns.regplot(x='x',y='y',data=data) #注意data[1]这指的是行,data.ioc[10]这指的也是行,不同于R plt.title("regressionAndPlot") plt.show()