jieguo=pd.DataFrame()
date=pd.DataFrame()
for g in CID:
res =data[data['ID']==g]
if res['time'].max==1:
k=0
else:
X = res['time'].values.reshape(-1, 1)
Y = res['count'].values.reshape(-1, 1)
model = LinearRegression().fit(X, Y)
k = model.coef
jieguo['K'] = k
jieguo['ID']=g
date = pd.concat([date, jieguo], ignore_index=True)
Traceback (most recent call last):
File "F:\学习\wer\w\F变化趋势.py", line 27, in
KK = model.coef
AttributeError: 'LinearRegression' object has no attribute 'coef'