Home > OS >  How to have only One index col for my dataset?
How to have only One index col for my dataset?

Time:08-26

I am working with the following dataset: enter image description here

If you observe I am now having 3 index-like cols. I want to get rid of that and only have 1. Normally it would not have been a problem, but I am trying to deploy my model using flask and I am getting an error saying that ValueError: X has 25 features, but MultinomialNB is expecting 28 features as input. I want to get rid of this problem.

CodePudding user response:

You can use pandas.DataFrame.drop

If df is your DataFrame:

df = df.drop('ID', axis=1)

This will remove the ID column

  • Related