sksports.extraction.gradient_elevation

sksports.extraction.gradient_elevation(activity, periods=5, append=True)[source][source]

Compute the elevation gradient.

Read more in the User Guide.

Parameters:
activity : DataFrame

The activity containing elevation and distance information.

periods : int, default=5

Periods to shift to compute the elevation gradient.

append : bool, optional

Whether to append the elevation gradient to the original activity (default) or to only return the elevation gradient as a Series.

Returns:
data : DataFrame or Series

The original activity with an additional column containing the elevation gradient or a single Series containing the elevation gradient.

Examples

>>> from sksports.datasets import load_fit
>>> from sksports.io import bikeread
>>> from sksports.extraction import gradient_elevation
>>> ride = bikeread(load_fit()[0])
>>> new_ride = gradient_elevation(ride)