I have a dataframe which contains 300 value of height and I want to calculate the standard deviation and also variance of each 15 rows. I supposed to have 20 var and st.deviation. So far I have done like the written script, but it doesn't work. I think my problem is on how should I call the standard deviation and variance, because when I did to calculate mean and median the script works fine. How can I fix it by using python? thankyou
import statistics
grouper = df.groupby(df.index // 15)
df_var = grouper.agg(
statistics.pstdev(df["height"])
,statistics.stdev(df["height"])
)