I'm trying to drop the first column of a data frame, when I run
X.columns.tolist()
I get this:
['colors', 'num_critic_for_reviews', 'duration', 'director_facebook_likes', 'actor_3_facebook_likes']
so, I want to drop 'colors', but when I run
X = X.drop('colors', index=1) I get:
KeyError: "['colors'] not found in axis"
I tried with the column index and also with the column label, but keep getting the same error. The funny thing is if I tried to access and use the column colors
it works, but again if I try to drop it, get the Not found in the axis
error.
source https://stackoverflow.com/questions/70488183/python-pandas-error-trying-to-drop-the-first-column
Comments
Post a Comment