使用Anaconda 3-5.3.1, 内含的jupyter notebook 5.4
不知是否有人遇到过这种情况,我是Macbook,刚升级系统到10.14.5
数据没找到怎么上传,样例如下:
import pandas as pd
from matplotlib import pyplot as plt
df = pd.read_csv('data/salary.csv', index_col = 0)
X = df[['year']]
Y = df['salary'].values
plt.scatter(X,Y, color="black")
plt.xlabel('year')
plt.ylabel('salary')
from sklearn.linear_model import LinearRegression
regr = LinearRegression()
regr.fit(X,Y)
plt.scatter(X,Y, color="black")
plt.plot(X, regr.predict(X), linewidth = 3, color = "blue")
plt.xlabel('year')
plt.ylabel('salary')