When setting a column name for a pandas dataframe, why does the following work:
df_coeff = pd.DataFrame(data = lm.coef_, index = X.columns, columns = ['Coefficient'])
While this does not work
df_coeff = pd.DataFrame(data = lm.coef_, index = X.columns, columns = 'Coefficient')
Why are brackets required around the column name? What is Python doing here?
Thanks