Can I dynamically choose the method applied on a pandas Resampler object?
问题 I am trying to create a function which resamples time series data in pandas . I would like to have the option to specify the type of aggregation that occurs depending on what type of data I am sending through (i.e. for some data, taking the sum of each bin is appropriate, while for others, taking the mean is needed, etc.). For example data like these: import pandas as pd import numpy as np dr = pd.date_range('01-01-2020', '01-03-2020', freq='1H') df = pd.DataFrame(np.random.rand(len(dr)),