Screen Link:
https://app.dataquest.io/m/238/ordinary-least-squares/1/introduction
Answer Code:
X = X[['bias'] + features]
I know that this code takes the existing columns of dataframe X and moves the ‘bias’ column to become the first column, but I dont recall seeing this method for rearraging columns. What is it called and how does it work? I have seen operations like this:
selected = df[['Age', 'Price_average', 'Email', 'Brand']]
and I know that features
is a list of column names, but I dont know what the +
is doing there. Thanks!