Apr-13-2019, 07:39 PM
#I'm using the following to generate linear model coefficients
#I'm only showing some of the code here
#They print out OK in the DOS window
# Trying worksheet.write (row, col, clf.coef_) just throws an error
# Think it might have something to do with it being an array.
I'm a real newbie here so hopelessly lost.
Any help greatly appreciated even if just a suggestion. Thanks
#I'm only showing some of the code here
#They print out OK in the DOS window
import numpy as np
from sklearn.preprocessing import PolynomialFeatures
from sklearn import linear_model
clf = linear_model.LinearRegression()
print("Coefficients: ", clf.coef_)#But how can I write the coefficients out to Excel using xlsxwriter...import xlsxwriter
workbook = xlsxwriter.Workbook('Test.xlsx')
worksheet = workbook.add_worksheet('MySheet')
#code goes here
workbook.close()#I'm not sure how to do this and been trying for hours# Trying worksheet.write (row, col, clf.coef_) just throws an error
# Think it might have something to do with it being an array.
I'm a real newbie here so hopelessly lost.
Any help greatly appreciated even if just a suggestion. Thanks
