Open prerana333 opened 4 years ago
KeyError Traceback (most recent call last) /anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance) 2656 try: -> 2657 return self._engine.get_loc(key) 2658 except KeyError:
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
KeyError: 'is_duplicate'
During handling of the above exception, another exception occurred:
KeyError Traceback (most recent call last)
Y = train_df['is_duplicate']
This is assigning all the labels/predictions to the Y
You are getting error: because maybe your dataframe df
doesn't have the 'is_duplicate'
column.
Run: train_df.head()
to see if the column is present
Can also this check via: df.columns
See the image:
Y = train_df['is_duplicate'] I do not understand this part of the code in train.py