Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------------------------------------------------
- TypeError Traceback (most recent call last)
- /opt/conda/lib/python3.7/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-84-d4d8c23f60f6> in <module>
- 24 return pay
- 25
- ---> 26 total_pivot['pay'] =total_pivot.apply(pay, axis = 1)
- /opt/conda/lib/python3.7/site-packages/pandas/core/frame.py in apply(self, func, axis, broadcast, raw, reduce, result_type, args, **kwds)
- 6911 kwds=kwds,
- 6912 )
- -> 6913 return op.get_result()
- 6914
- 6915 def applymap(self, func):
- /opt/conda/lib/python3.7/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):
- /opt/conda/lib/python3.7/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
- /opt/conda/lib/python3.7/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-84-d4d8c23f60f6> in pay(data)
- 2 def pay (data):
- 3 pay = 0
- ----> 4 tariff = data['tariff']
- 5 duration = data['duration_total_sum']
- 6 gd = data['gb_used_total']
- /opt/conda/lib/python3.7/site-packages/pandas/core/series.py in __getitem__(self, key)
- 1066 key = com.apply_if_callable(key, self)
- 1067 try:
- -> 1068 result = self.index.get_value(self, key)
- 1069
- 1070 if not is_scalar(result):
- /opt/conda/lib/python3.7/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
- /opt/conda/lib/python3.7/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: ('tariff', 'occurred at index (1000, 5, ultra)')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement