Challenge: Grouped Summary Table
Swipe to start coding
Given a DataFrame with columns 'experiment', 'group', and 'score', create a function that returns a new DataFrame showing the mean and standard deviation of 'score' for each combination of 'experiment' and 'group'. The resulting DataFrame should have a multi-level index with 'experiment' and 'group'.
- Group the input DataFrame by the
'experiment'and'group'columns. - Calculate the mean and standard deviation of the
'score'column for each group. - Return a new DataFrame with the results, using a multi-level index of
'experiment'and'group'.
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 5
Challenge: Grouped Summary Table
Swipe to show menu
Swipe to start coding
Given a DataFrame with columns 'experiment', 'group', and 'score', create a function that returns a new DataFrame showing the mean and standard deviation of 'score' for each combination of 'experiment' and 'group'. The resulting DataFrame should have a multi-level index with 'experiment' and 'group'.
- Group the input DataFrame by the
'experiment'and'group'columns. - Calculate the mean and standard deviation of the
'score'column for each group. - Return a new DataFrame with the results, using a multi-level index of
'experiment'and'group'.
Solution
Thanks for your feedback!
single