Advertisement
OnestoAlex

Untitled

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