简体   繁体   中英

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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM