Skip to content
Advertisement

groupby with diff function

I have a groupby with a diff function, however I want to add an extra mean column for heart rate, how can I do this the best way?

this is the code

JavaScript

where should I add in the piece of code to calculate the average heart rate?

output will be the amount of seconds in high power zone and then i would like to add the average heart rate during this period. like this

JavaScript

Advertisement

Answer

You can create helper column from by difference and then aggregate by it and another column in named aggregation in GroupBy.agg:

JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement