atgmello

As & With bug

Aug 21st, 2019
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.77 KB | None | 0 0
  1. ---------------------------------------------------------------------------
  2. KeyError                                  Traceback (most recent call last)
  3. <ipython-input-64-9dfdda7a59fb> in <module>
  4.       1 # Check your answer
  5. ----> 2 q_3.check()
  6.  
  7. /opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in wrapped(self, *args, **kwargs)
  8.      22     def wrapped(self, *args, **kwargs):
  9.      23         self.interactions[method.__name__] += 1
  10. ---> 24         return method(self, *args, **kwargs)
  11.      25     return wrapped
  12.      26
  13.  
  14. /opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in wrapped(*args, **kwargs)
  15.      13     @functools.wraps(fn)
  16.      14     def wrapped(*args, **kwargs):
  17. ---> 15         res = fn(*args, **kwargs)
  18.      16         display(res)
  19.      17         # Don't propagate the return to avoid double printing.
  20.  
  21. /opt/conda/lib/python3.6/site-packages/learntools/core/problem_view.py in check(self)
  22.      91                 args = ()
  23.      92             self.problem.check_whether_attempted(*args)
  24. ---> 93             self.problem.check(*args)
  25.      94         except NotAttempted as e:
  26.      95             self._track_check(tracking.OutcomeType.UNATTEMPTED)
  27.  
  28. /opt/conda/lib/python3.6/site-packages/learntools/sql/ex5.py in check(self, results)
  29.     100         year_to_check = list(rides_per_year_answer["year"])[0]
  30.     101         correct_number = int(rides_per_year_answer.loc[rides_per_year_answer["year"]==year_to_check]["num_trips"][0])
  31. --> 102         submitted_number = int(results.loc[results["year"]==year_to_check]["num_trips"][0])
  32.     103         assert (correct_number == submitted_number), ("The results don't look right. Try again.")
  33.     104
  34.  
  35. /opt/conda/lib/python3.6/site-packages/pandas/core/series.py in __getitem__(self, key)
  36.     765         key = com._apply_if_callable(key, self)
  37.     766         try:
  38. --> 767             result = self.index.get_value(self, key)
  39.     768
  40.     769             if not is_scalar(result):
  41.  
  42. /opt/conda/lib/python3.6/site-packages/pandas/core/indexes/base.py in get_value(self, series, key)
  43.    3116         try:
  44.    3117             return self._engine.get_value(s, k,
  45. -> 3118                                           tz=getattr(series.dtype, 'tz', None))
  46.    3119         except KeyError as e1:
  47.    3120             if len(self) > 0 and self.inferred_type in ['integer', 'boolean']:
  48.  
  49. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
  50.  
  51. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_value()
  52.  
  53. pandas/_libs/index.pyx in pandas._libs.index.IndexEngine.get_loc()
  54.  
  55. pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
  56.  
  57. pandas/_libs/hashtable_class_helper.pxi in pandas._libs.hashtable.Int64HashTable.get_item()
  58.  
  59. KeyError: 0
Advertisement
Add Comment
Please, Sign In to add comment