0

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
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
lincolnab
  • 47
  • 6

1 Answers1

1
df.groupby(["school", "class"]).passed_or_not.value_counts(normalize=True)*100.reset_index(name='share')
Trenton McKinney
  • 56,955
  • 33
  • 144
  • 158
lincolnab
  • 47
  • 6