-3

I guys I need answer this question.

Drop the columns "id" and "Unnamed: 0" from axis 1 using the method drop(), then use the method describe() to obtain a statistical summary of the data. Take a screenshot and submit it, make sure the inplace parameter is set to True

This my code and it isnt working... where am I going wrong?

df.drop('id', 'Unnamed: 0', axis=1, inplace=True)
df.describe()
Erfan
  • 40,971
  • 8
  • 66
  • 78
throssell
  • 5
  • 3

1 Answers1

0

Your syntax is wrong

df.drop syntax

You have to say exactly what you want to drop in the form :

df.drop(df.columns[0], axis=1, inplace=True)

this is an example for your unamed : 0

You should have started by the docs (also for your future problems using python Libraries, because it will treat many cases and it's quite complete and clear)

To be honest, your syntax is not "wrong" but you're asking pandas to drop an entire variable by doing this, so it can work with 'id' but not with unamed : 0 which is technically not a variable (not assigned at least).

So basically the answer you should have (easily) found should be :

df.drop(['id', 'Unnamed: 0'], axis=1, inplace=True)
Dinger
  • 28
  • 7