Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

semantic analysis #5

Open
prerana333 opened this issue Dec 19, 2019 · 2 comments
Open

semantic analysis #5

prerana333 opened this issue Dec 19, 2019 · 2 comments

Comments

@prerana333
Copy link

prerana333 commented Dec 19, 2019

Y = train_df['is_duplicate']
I do not understand this part of the code in train.py

@prerana333
Copy link
Author


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)
in
11
12 X = df[['text1_n', 'text2_n']]
---> 13 Y = df['is_duplicate']
14
15 X_train, X_validation, Y_train, Y_validation = train_test_split(X, Y, test_size=validation_size)

/anaconda3/lib/python3.7/site-packages/pandas/core/frame.py in getitem(self, key)
2925 if self.columns.nlevels > 1:
2926 return self._getitem_multilevel(key)
-> 2927 indexer = self.columns.get_loc(key)
2928 if is_integer(indexer):
2929 indexer = [indexer]

/anaconda3/lib/python3.7/site-packages/pandas/core/indexes/base.py in get_loc(self, key, method, tolerance)
2657 return self._engine.get_loc(key)
2658 except KeyError:
-> 2659 return self._engine.get_loc(self._maybe_cast_indexer(key))
2660 indexer = self.get_indexer([key], method=method, tolerance=tolerance)
2661 if indexer.ndim > 1 or indexer.size > 1:

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'

@viv1729
Copy link

viv1729 commented Dec 21, 2019

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:
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants