Jase C
Jase C

Reputation: 17

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.sstatic.net/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.sstatic.net/1yd3j.png) Same for building code. I appreciate any pointers.

Upvotes: 0

Views: 550

Answers (1)

Rodrigo Guzman
Rodrigo Guzman

Reputation: 487

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

Upvotes: 1

Related Questions