heartandsole.Activity.distance.records_from_position
- Activity.distance.records_from_position(inplace=False)[source]
Cumulative distance records calculated from GPS coordinate records.
- Parameters
inplace (bool) – Whether to add the Series result as a column to the records DataFrame. Default False.
- Returns
The Series result or None if
inplace=Trueor if the records DataFrame does not containlatandloncolumns.- Return type
pandas.Series or None
Examples
When called with
inplace=False, this method returns a Series:>>> records = pd.DataFrame({ ... 'lat': [40.0, 40.0001, 40.0002], ... 'lon': [-105.2, -105.2, -105.2] ... }) >>> act = Activity(records) >>> act.distance.records_from_position() 0 0.000000 1 11.119493 2 22.238985 dtype: float64
When called with
inplace=True, this method updates the records DataFrame:>>> act.distance.records_from_position(inplace=True) >>> act.records lat lon distance 0 40.0000 -105.2 0.000000 1 40.0001 -105.2 11.119493 2 40.0002 -105.2 22.238985
See also
pandas.DataFrame.xyz.s_from_xy()Custom DataFrame accessor method for calculating cumulative distance from GPS coordinates. From the
pandas-xyzpackage.