Exercise

Reviewing the moves

Wow! You have now learned about pivot tables. In the last analysis that you did, you encountered a DataFrame that had non-unique index/column pairs. In order to pivot your DataFrame, you wrote code to drop the last row, and then reshaped it.

In this exercise, you will modify the code using pivot tables and compare it with your strategy of using the pivot method.

The fifa_players dataset is available for you.

Instructions

100 XP
  • Discard the fifth row of the fifa_players DataFrame.
  • Use .pivot() on fifa_players to get all the scores indexed by name, and identified by movement in the columns.
  • Use a pivot table to show the mean of all scores by name and movement, setting name as index.