Is there a way to pass a string parameter as a choice of a method(). Example below - can it be done in a simpler way instead of repeating the aggregation statements?
def ts_resample(
df, aggregation="mean", resampling_freq="60S",
):
### RESAMPLE ###
if aggregation == "mean":
df_r = df.resample(resampling_freq).mean()
elif aggregation == "median":
df_r = df.resample(resampling_freq).median()
elif aggregation == "std":
df_r = df.resample(resampling_freq).std()
### RETURN ###
return df_r