Hadeer Hamdy
Hadeer Hamdy

Reputation: 1

Dropping column in pandas issue

This is sample of my dataset

id   imdb_id  popularity  budget     revenue   cast         runtime
1357 0        3.1         150000000  20000000  Chris Pratt  124

and here is my code

df.drop(['imdb_id', 'cast', 'runtime'], axis=1 , inplace=True)

i got this error

ValueError: labels ['imdb_id' 'cast', 'runtime'] not contained in axis

Upvotes: 0

Views: 69

Answers (1)

Abramodj
Abramodj

Reputation: 5879

I noticed a missing , in labels ['imdb_id' 'cast', 'runtime'].

Could that be the problem?

Otherwise, make sure the names of the columns do not contain white spaces by printing df.columns

Upvotes: 1

Related Questions