Python: Issue With Groupby() And Apply() When Applying Defined Haversine Function
I am trying to compute the distance of the following dataset through a defined haversine function. The function works well on other data. However, in this particular dataset, I am
Solution 1:
If you add print(lat1) to your haversine function, you get this printed:
356a192b7913b04c54574d18c28d46e6395428abNaN356a192b7913b04c54574d18c28d46e6395428ab57.723610356a192b7913b04c54574d18c28d46e6395428ab57.723614Name:latitude_pre,dtype:float64356a192b7913b04c54574d18c28d46e6395428abNaN356a192b7913b04c54574d18c28d46e6395428ab57.723610356a192b7913b04c54574d18c28d46e6395428ab57.723614Name:latitude_pre,dtype:float64356a192b7913b04c54574d18c28d46e6395428abNaN356a192b7913b04c54574d18c28d46e6395428ab57.723610356a192b7913b04c54574d18c28d46e6395428ab57.723614Name:latitude_pre,dtype:float64356a192b7913b04c54574d18c28d46e6395428abNaN356a192b7913b04c54574d18c28d46e6395428ab57.723610356a192b7913b04c54574d18c28d46e6395428ab57.723614Name:latitude_pre,dtype:float64
The 'value' of lat1 is a series not a single value. Is that what you want? It's not clear that is what you want, but the error I believe is there because it's looking for single value.
Post a Comment for "Python: Issue With Groupby() And Apply() When Applying Defined Haversine Function"