sksports.extraction
.gradient_heart_rate¶
-
sksports.extraction.
gradient_heart_rate
(activity, periods=5, append=True)[source][source]¶ Compute the heart-rate gradient.
Read more in the User Guide.
Parameters: - activity : DataFrame
The activity containing heart-rate information.
- periods : int, default=5
Periods to shift to compute the heart-rate gradient.
- append : bool, optional
Whether to append the heart-rate gradient to the original activity (default) or to only return the heart-rate gradient as a Series.
Returns: - data : DataFrame or Series
The original activity with an additional column containing the heart-rate gradient or a single Series containing the heart-rate gradient.
Examples
>>> import numpy as np >>> import pandas as pd >>> from sksports.datasets import load_fit >>> from sksports.io import bikeread >>> from sksports.extraction import gradient_heart_rate >>> ride = bikeread(load_fit()[0]) >>> ride['heart-rate'] = pd.Series( ... np.random.randint(60, 200, size=ride.shape[0]), ... index=ride.index) # Add fake heart-rate data for the example >>> new_ride = gradient_heart_rate(ride)