Home > Enterprise >  Not able to drop a column in a pandas dataframe
Not able to drop a column in a pandas dataframe

Time:10-28

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.

CodePudding user response:

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

  • Related