KeyError in Big Mart Sales Problem



Yes, this method does not give the KeyError but if you notice the total number of null values after the imputing step, it still says there are null values (4 null values remaining in my case)


Got the reason why it is working for only few of us. Those who have skipped merging of train and test data are likely to get this error. Please perform that step as the author is suggesting that it is a good idea to combine both the datasets while doing the feature engineering.
Please execute the below step and it will start working
data = pd.concat([train, test],ignore_index=True)
print train.shape, test.shape, data.shape


if you have find the solution of above error then help me because i have same issue.


Is it because of different Python versions? I am noticing the author is using Python2? Could it be that? You can use this code instead:



just ADD this: loc

lambda x: visibility_avg.loc[x]