Calculates the Bearing between two points. The bearing is the compass direction to travel from a starting point, and must be within the range 0 to 360.
Signature: ds.feature_engineering.bearing(lat1, long1, lat2, long2)Docstring:Calculates the Bearing between two points.The bearing is the compass direction to travel from a starting point,and must be within the range0 to 360.Parameter:------------------------- lat1: scalar,float Start point latitude of the location. lat2: scalar,float End point latitude of the location. long1: scalar,float Start point longitude of the location. long2: scalar,float End point longitude of the location.Returns: Series
Examples
>>>import datasist as ds>>>import numpy as np >>>import pandas as pddf = pd.DataFrame(data =[[8.6753,9.0820,9.4281,6.4281], [9.6753,8.0820,8.4281,7.4281], [4.6753,3.0820,1.4281,3.4281]], columns = ['lat1','long1','lat2','long2'])>>> df lat1 long1 lat2 long208.67539.08209.42816.428119.67538.08208.42817.428124.67533.08201.42813.4281>>> ds.feature_engineering.bearing(lat1=df.lat1,long1=df.long1,lat2=df.lat2,long2=df.long2)0-73.7681051-152.5742912173.914669dtype: float64