Answers for "resample time series data pandas"

1

resample pandas

df.resample("W").agg(['min','max','mean','std'])

#  resample("3T") ==> 3 minutes
#  resample("30S") ==> 30 seconds
#  resample("1H") ==> 1 hour
#  resample("D") ==> day
#  resample("W") ==> week
#  resample("M") ==> month
#  resample("Y") ==> year  
#  resample("Q") ==> quarter
#  Ex. 2018-01-01 ==> 2018-03-01 , 2018-06-01 , 2018-09-01 , 2018-12-01 
#####################################
#  .mean() 
#  .max()
#  .min() 
#  .sum()
......
#  .agg(['min','max',...]) specified functions are applied for every column
Posted by: Guest on September-25-2021

Python Answers by Framework

Browse Popular Code Answers by Language