Chapter 9 - Key Error


Can anybody please coach me through why I’m getting a key error (see image)?

I ran print(df.columns.tolist()) but there is no variable called ‘SalePrice’

Any suggestions, please?


SalePrice(dep_var) is the target variable. It should be present in the dataframe passed to TabularPandas (for train and valid). Hence the error.

The information in screenshot is not enough to say why SalePrice is not in your df. Need to see how df is being created.

Rightho, thanks. I’ll take another look.