The error message states: "['Ticket', 'Cabin', 'Name', 'PassengerId'] not found in axis."I tried writing axis=1 while accessing the columns, but the KeyError persists. I'm not sure why this is happening, and I need some help troubleshooting the issue. Please Help!!!!!
Asked
Active
Viewed 7 times
0
-
First of all if your question relaters to Pandas, don't use the kaggle tag, secondly, please edit your question to show entire error message, Third, your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 Jul 30 '23 at 19:21
-
I think you are trying df['Ticket', 'Cabin', 'Name', 'PassengerId'] instead of df[['Ticket', 'Cabin', 'Name', 'PassengerId']] (with 2 brackets) – filani Jul 30 '23 at 19:22