Tag Archives: Stubborn on pit

TypeError: drop() got an unexpected keyword argument ‘columns’

TypeError: drop() got an unexpected keyword argument ‘columns’

train.drop(columns=["Unnamed: 0"], inplace=True)
test.drop(columns=["Unnamed: 0"], inplace=True)

The reason for the above error is that pandas only added the columns keyword in version 0.21, but not in 0.20.
Solution:
upgrade panda package

pip install --upgrade pandas

View panda version

print (pd.__version__)