I am currently using a tree based model for self training purposes and there is one area of code I get stuck. I used One-hot code to extract additional columns from my original data. Viewing the dataframe the new columns are visible, but trying to split the data into new features (X) and response (y), I continually get the KeyError that the new columns are not in the index.
My code:
My code:
X = df.loc[:, ["Mileage", "AgeP", "Category_SAV", "Category_SUV", "Category_Sedan", "Category_Small", "Category_Super"]] y = df.loc[:, "Claim"]The error however is only on the Category_ index columns even though I see these in the dataframe.
buran write May-16-2023, 05:26 PM:
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.
Please, use proper tags when post code, traceback, output, etc. This time I have added tags for you.
See BBcode help for more info.