I have schools and classes to analyze % of students succeed exams. If I do so the output is series of multi indexes. But I need a dataframe from this as an output.
df.groupby(["school","class"]).passed_or_not.value_counts(normalize=True)*100
I have schools and classes to analyze % of students succeed exams. If I do so the output is series of multi indexes. But I need a dataframe from this as an output.
df.groupby(["school","class"]).passed_or_not.value_counts(normalize=True)*100
df.groupby(["school", "class"]).passed_or_not.value_counts(normalize=True)*100.reset_index(name='share')