Question: getting Type error - - - > 8 1 cost _ per _ route = revenue _ per _ route.apply ( lambda x: calculate _

getting
Type error
--->81 cost_per_route = revenue_per_route.apply(lambda x: calculate_route_cost((x['ORIGIN'], x['DESTINATION'])), axis=1)
File /Library/Frameworks/Python.framework/Versions/3.13/lib/python3.13/site-packages/pandas/core/apply.py:916, in FrameApply.apply(self)
...
51 def _sum(a, axis=None, dtype=None, out=None, keepdims=False,
52 initial=_NoValue, where=True):
--->53return umr_sum(a, axis, dtype, out, keepdims, initial, where)
TypeError: unsupported operand type(s) for +: 'float' and 'str'

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!