I am creating a summary table for a data I just explored.
I wrote this code;
reg_summary = pd.DataFrame([[‘Intercept’],[‘SAT’],[‘Rand 1,2,3’]], columns = [‘Features’])
reg_summary[‘Weights’] = reg.intercept_, reg.coef_[0], reg.coef_[1]
reg_summary
Instead of a summary table, it gave me this;
IndexError Traceback (most recent call last)
Cell In[16], line 2
1 reg_summary = pd.DataFrame([[‘Intercept’],[‘SAT’],[‘Rand 1,2,3’]], columns = [‘Features’])
—-> 2 reg_summary[‘Weights’] = reg.intercept_, reg.coef_[0], reg_summary.append(reg.coef_[1])
IndexError: index 1 is out of bounds for axis 0 with size 1
MICHAEL ODURO SEKYERE is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.