1. Learn
  2. /
  3. Courses
  4. /
  5. Reshaping Data with pandas

Connected

Exercise

Exploring the big match

Now, it's time to continue working on the fifa_players exploration. Your next task is to examine the characteristics of players belonging to different teams.

Particularly, you are interested in players from two big rival teams: Barcelona and Real Madrid.

You decide that .pivot_table() is the best tool to get your results since it's an easy way to generate a report. Also, it allows you to define aggregation functions and work with multiple indices.

The fifa_players dataset is available for you. _Make sure you explore it. Check which data it contains from the players playing for each team.

Instructions 1/3

undefined XP
  • 1

    Use a pivot table to show the mean age of players in fifa_players by club and nationality. Set nationality as the index.

  • 2

    Use a pivot table to show the maximum height of any player by club and nationality, setting nationality as the index.

  • 3

    Define the DataFrame players_country that shows the player count by club and nationality and get the total count.