Advertisement
Guest User

Untitled

a guest
Apr 8th, 2020
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.21 KB | None | 0 0
  1. TypeError                                 Traceback (most recent call last)
  2. ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
  3.    4735             try:
  4. -> 4736                 return libindex.get_value_box(s, key)
  5.    4737             except IndexError:
  6.  
  7. pandas/_libs/index.pyx in pandas._libs.index.get_value_box()
  8.  
  9. pandas/_libs/index.pyx in pandas._libs.index.get_value_at()
  10.  
  11. pandas/_libs/util.pxd in pandas._libs.util.get_value_at()
  12.  
  13. pandas/_libs/util.pxd in pandas._libs.util.validate_indexer()
  14.  
  15. TypeError: 'str' object cannot be interpreted as an integer
  16.  
  17. During handling of the above exception, another exception occurred:
  18.  
  19. KeyError                                  Traceback (most recent call last)
  20. <ipython-input-55-43bb42d2d1da> in <module>
  21. ----> 1 acc_list = evaluate_results(predicted_reqs, matches)
  22.  
  23. <ipython-input-53-280295f8f204> in evaluate_results(predicted_reqs, true_req_pairs)
  24.       7     best10_pred = predicted_reqs.head(10).T.apply(lambda x: set(x.tolist()), axis=1)
  25.       8     accuracy1 = true_req_pairs.to_frame().apply(
  26. ----> 9         lambda x: bool(set(x[0]).intersection(best_pred[x.name])), axis=1).mean()
  27.      10     accuracy2 = true_req_pairs.to_frame().apply(
  28.      11         lambda x: bool(set(x[0]).intersection(best2_pred[x.name])), axis=1).mean()
  29.  
  30. ~\Anaconda3\lib\site-packages\pandas\core\frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)
  31.    6926             kwds=kwds,
  32.    6927         )
  33. -> 6928         return op.get_result()
  34.    6929
  35.    6930     def applymap(self, func):
  36.  
  37. ~\Anaconda3\lib\site-packages\pandas\core\apply.py in get_result(self)
  38.     184             return self.apply_raw()
  39.     185
  40. --> 186         return self.apply_standard()
  41.     187
  42.     188     def apply_empty_result(self):
  43.  
  44. ~\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_standard(self)
  45.     290
  46.     291         # compute the result using the series generator
  47. --> 292         self.apply_series_generator()
  48.     293
  49.     294         # wrap results
  50.  
  51. ~\Anaconda3\lib\site-packages\pandas\core\apply.py in apply_series_generator(self)
  52.     319             try:
  53.     320                 for i, v in enumerate(series_gen):
  54. --> 321                     results[i] = self.f(v)
  55.     322                     keys.append(v.name)
  56.     323             except Exception as e:
  57.  
  58. <ipython-input-53-280295f8f204> in <lambda>(x)
  59.       7     best10_pred = predicted_reqs.head(10).T.apply(lambda x: set(x.tolist()), axis=1)
  60.       8     accuracy1 = true_req_pairs.to_frame().apply(
  61. ----> 9         lambda x: bool(set(x[0]).intersection(best_pred[x.name])), axis=1).mean()
  62.      10     accuracy2 = true_req_pairs.to_frame().apply(
  63.      11         lambda x: bool(set(x[0]).intersection(best2_pred[x.name])), axis=1).mean()
  64.  
  65. ~\Anaconda3\lib\site-packages\pandas\core\series.py in __getitem__(self, key)
  66.    1069         key = com.apply_if_callable(key, self)
  67.    1070         try:
  68. -> 1071             result = self.index.get_value(self, key)
  69.    1072
  70.    1073             if not is_scalar(result):
  71.  
  72. ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
  73.    4742                     raise InvalidIndexError(key)
  74.    4743                 else:
  75. -> 4744                     raise e1
  76.    4745             except Exception:  # pragma: no cover
  77.    4746                 raise e1
  78.  
  79. ~\Anaconda3\lib\site-packages\pandas\core\indexes\base.py in get_value(self, series, key)
  80.    4728         k = self._convert_scalar_indexer(k, kind="getitem")
  81.    4729         try:
  82. -> 4730             return self._engine.get_value(s, k, tz=getattr(series.dtype, "tz", None))
  83.    4731         except KeyError as e1:
  84.    4732             if len(self) > 0 and (self.holds_integer() or self.is_boolean()):
  85.  
  86. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
  87.  
  88. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
  89.  
  90. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  91.  
  92. pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  93.  
  94. pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()
  95.  
  96. KeyError: ('new_req5', 'occurred at index new_req5')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement