I have a simple pyspark function
features=['x', 'y', 'z']
def f(features):
df.groupBy('id').agg(collect_list(features[0]), collect_list(features[1]), ....)
I want it so that if someone passes in features=['x', 'y', 'z', 'a'] each thing in features will have its own collect_list function in the agg function. How can I do this? They all have to be in the same agg function