Skip to content

Instantly share code, notes, and snippets.

@btotr
Created December 29, 2022 21:32
Show Gist options
  • Save btotr/537e5292ee2f13c82310936be829a5b5 to your computer and use it in GitHub Desktop.
Save btotr/537e5292ee2f13c82310936be829a5b5 to your computer and use it in GitHub Desktop.
##
## Normalized power
##
import pandas as pd
import numpy as np
def cycling_np(s):
rolling = s.dropna().rolling(30).mean().dropna()
NP = round((((rolling**4).mean())**0.25),0)
return(NP)
watts = pd.Series(np.asarray(GC.series(GC.SERIES_WATTS)))
np = cycling_np(watts)
print(np)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment