Untitled
sorted_logs_new = logs_new.sort_values(by='device_id', ascending=False) event_funnel_by_group = sorted_logs_new.pivot_table(index='event_name', columns='group', values='device_id', aggfunc=pd.Series.nunique)\ .reset_index() display(event_funnel_by_group)