Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Not able to drop a column in a pandas dataframe

I am a beginner in data analysis with python, and I am currently stuck on why I keep getting a key error even after looking up multiple sources on how to fix it. Here is a small sample of my data
(https://i.stack.imgur.com/X1N4q.png)

I have tried running this code:
SATdf.drop(['School ID'], axis=1, inplace= True) SATdf.drop(['Building Code'], axis=1, inplace = True)
However I keep getting this error:
(https://i.stack.imgur.com/1yd3j.png)
Same for building code.
I appreciate any pointers.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Have you tried SATdf.drop(columns=['School ID','Building Code'], inplace= True) ?

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading