#takes group object applys a group by civil twilight groupby then takes the avearge of several columns
funct_day_night = lambda x: [x['Severity'].mean(), x["Distance(mi)"].mean(), x['Severity'].count()]
group_group_df = group_df.apply(lambda g_df : g_df.groupby('Civil_Twilight').apply(funct_day_night))
group_group_df
I want to turn all of the output on the right into columns. Please link me to the documentation I was not sure what to even look up. It might be best to answer the question in two parts one with fixing the function above and the other with fixing the out put either solution will work for me.
The data set I used was: https://www.kaggle.com/sobhanmoosavi/us-accidents