sksports.extraction.acceleration

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

Compute the acceleration (i.e. speed gradient).

Read more in the User Guide.

Parameters:
activity : DataFrame

The activity containing speed information.

periods : int, default=5

Periods to shift to compute the acceleration.

append : bool, optional

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

Returns:
data : DataFrame or Series

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

Examples

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