Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- TypeError Traceback (most recent call last)
- ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
- 4735 try:
- -> 4736 return libindex.get_value_box(s, key)
- 4737 except IndexError:
- pandas/_libs/index.pyx in pandas._libs.index.get_value_box()
- pandas/_libs/index.pyx in pandas._libs.index.get_value_at()
- pandas/_libs/util.pxd in pandas._libs.util.get_value_at()
- pandas/_libs/util.pxd in pandas._libs.util.validate_indexer()
- TypeError: 'str' object cannot be interpreted as an integer
- During handling of the above exception, another exception occurred:
- KeyError Traceback (most recent call last)
- <ipython-input-55-43bb42d2d1da> in <module>
- ----> 1 acc_list = evaluate_results(predicted_reqs, matches)
- <ipython-input-53-280295f8f204> in evaluate_results(predicted_reqs, true_req_pairs)
- 7 best10_pred = predicted_reqs.head(10).T.apply(lambda x: set(x.tolist()), axis=1)
- 8 accuracy1 = true_req_pairs.to_frame().apply(
- ----> 9 lambda x: bool(set(x[0]).intersection(best_pred[x.name])), axis=1).mean()
- 10 accuracy2 = true_req_pairs.to_frame().apply(
- 11 lambda x: bool(set(x[0]).intersection(best2_pred[x.name])), axis=1).mean()
- ~\Anaconda3\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)
- 6926 kwds=kwds,
- 6927 )
- -> 6928 return op.get_result()
- 6929
- 6930 def applymap(self, func):
- ~\Anaconda3\lib\site-packages\pandas\core\apply.py in get_result(self)
- 184 return self.apply_raw()
- 185
- --> 186 return self.apply_standard()
- 187
- 188 def apply_empty_result(self):
- ~\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_standard(self)
- 290
- 291 # compute the result using the series generator
- --> 292 self.apply_series_generator()
- 293
- 294 # wrap results
- ~\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_series_generator(self)
- 319 try:
- 320 for i, v in enumerate(series_gen):
- --> 321 results[i] = self.f(v)
- 322 keys.append(v.name)
- 323 except Exception as e:
- <ipython-input-53-280295f8f204> in <lambda>(x)
- 7 best10_pred = predicted_reqs.head(10).T.apply(lambda x: set(x.tolist()), axis=1)
- 8 accuracy1 = true_req_pairs.to_frame().apply(
- ----> 9 lambda x: bool(set(x[0]).intersection(best_pred[x.name])), axis=1).mean()
- 10 accuracy2 = true_req_pairs.to_frame().apply(
- 11 lambda x: bool(set(x[0]).intersection(best2_pred[x.name])), axis=1).mean()
- ~\Anaconda3\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
- 1069 key = com.apply_if_callable(key, self)
- 1070 try:
- -> 1071 result = self.index.get_value(self, key)
- 1072
- 1073 if not is_scalar(result):
- ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
- 4742 raise InvalidIndexError(key)
- 4743 else:
- -> 4744 raise e1
- 4745 except Exception: # pragma: no cover
- 4746 raise e1
- ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
- 4728 k = self._convert_scalar_indexer(k, kind="getitem")
- 4729 try:
- -> 4730 return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
- 4731 except KeyError as e1:
- 4732 if len(self) > 0 and (self.holds_integer() or self.is_boolean()):
- pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
- pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
- 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: ('new_req5', 'occurred at index new_req5')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement