O'Reilly logo
  • Lina Vourgidou thinks this is interesting:

In [341]: mean_ratings = data.pivot_table('rating', rows='title', .....: cols='gender', aggfunc='mean')

From

Cover of Python for Data Analysis

Note

For Python 3:
mean_ratings = data.pivot_table('rating', 'title', 'gender', aggfunc='mean')