0

I am working on network traffic classification using tf.keras. I want to drop a column name Label and set Label as Y and all other columns in X. I am using pandas. here is the code line:

df =df.drop(['Label'], axis=1, inplace=True)

I am getting the following error:

KeyError Traceback (most recent call last)
in ()
----> 1 df =df.drop(['Label'], axis=1, inplace=True)

3 frames
/usr/local/lib/python3.6/dist-packages/pandas/core/indexes/base.py in drop(self, labels, errors)
5285 if mask.any():
5286 if errors != "ignore":
-> 5287 raise KeyError(f"{labels[mask]} not found in axis")
5288 indexer = indexer[~mask]
5289 return self.delete(indexer)

KeyError: "['Label'] not found in axis"

I have tried different methods but failed. anyone of you kindly help to get rid of this situation.

Lescurel
  • 10,749
  • 16
  • 39
h.ab
  • 11
  • 1
  • 1

0 Answers0