Answers for "use functions to resample python"

3

resampling data python

#Resample to monthly
df.resample('M').asfreq()
Posted by: Guest on August-13-2021
1

use functions to resample python

#We can also use custom functions and apply them when resampling using the .apply(method_name) method
#This is an example used in a downsampling example
def custom_resampler(arraylike):
    return np.sum(arraylike) + 5
data.resample('Q').apply(custom_resampler)
Posted by: Guest on August-13-2021

Python Answers by Framework

Browse Popular Code Answers by Language