sksports.extraction.gradient_activity

sksports.extraction.gradient_activity(activity, periods=1, append=True, columns=None)[source][source]

Compute the gradient for all given columns.

Read more in the User Guide.

Parameters:
activity : DataFrame

The activity to use to compute the gradient.

periods : int or array-like, default=1

Periods to shift to compute the gradient. If an array-like is given, several gradient will be computed.

append : bool, optional

Whether to append the gradients to the original activity.

columns : list, optional

The name of the columns to use to compute the gradient. By default, all the columns are used.

Returns:
gradient : DataFrame

The computed gradient from the activity.

Examples

>>> from sksports.datasets import load_fit
>>> from sksports.io import bikeread
>>> from sksports.extraction import gradient_activity
>>> ride = bikeread(load_fit()[0], drop_nan='columns')
>>> new_ride = acceleration(ride)