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.
This exercise is part of the course
Reshaping Data with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Use pivot table to display mean age of players by club and nationality
mean_age_fifa = fifa_players.____(index=____,
columns=____,
values=____,
aggfunc=____)
# Print mean_age_fifa
print(mean_age_fifa)