I need to write a function def group_and_aggregate_data(df:pd.DataFrame, group_by_column:str, agg_func) -> pd.DataFrame that groups my excel data by city name and and applies the agg_func passed as an argument. I tried this:
df_bycity = dataframe.groupby(cond).func()
return df_bycity
but it doesn’t work in Python