Player Stats: Wrangling with Football Data
Player Stats: Wrangling with Football Data Data Science Project
Data Wrangling with Pandas

Player Stats: Wrangling with Football Data

In this hands-on project, we'll explore a comprehensive dataset of football players from around the world. You'll learn how to use Pandas GroupBy operations to group data by various attributes such as club, division, and nationality. In addition, we will utilize both built-in and custom functions for the purpose of data aggregation. Get ready to dive into the world of data manipulation with football player statistics!
Start this project
Player Stats: Wrangling with Football DataPlayer Stats: Wrangling with Football Data
Project Created by

Lohith Unnam

Project Activities

All our Data Science projects include bite-sized activities to test your knowledge and practice in an environment with constant feedback.

All our activities include solutions with explanations on how they work and why we chose them.

codevalidated

Extract Players from Argentina and Store in DataFrame named `players_arg`

codevalidated

Extract Players with Preferred Foot as `Either` and Store in `players_preferred_foot_either`

input

Identify the Club with the Maximum Number of Players with Preferred Foot `Either`

Enter the name of the club with the highest number of players whose preferred foot is Either. If multiple clubs have the same number, choose the one that comes first alphabetically.

codevalidated

Compute Average Age of Players per Club

Calculate the average age of players for each club. Store the results in a dataframe named avg_age_per_club.

codevalidated

Calculate Total Value of Players per Division

Compute the total value of players within each division. Store the result in a dataframe named total_value_per_division.

input

Find Division with Players of Highest Value

codevalidated

Count Players by Preferred Foot and Store in `preferred_foot_counts`

input

Find Out Which Foot is Preferred by the Majority of Players

codevalidated

Determine Maximum Wage by Nation

Find the maximum wage of players from each nation. Store the result in a dataframe named max_wage_per_nation.

input

What is the Country with the Highest Wage Offering?

Enter the country's three-letter country code (e.g., FRA for France).

codevalidated

Calculate the average height and weight for each nation and store the results in a dataframe named `avg_height_weight_per_nation`

input

Determine the nation with the lowest average height and the nation with the highest average weight among players

Provide the answer in the following format: Nation with Lowest Height, Nation with Highest Weight (e.g., ALB, ZIM).

codevalidated

Calculate the total stamina for each club and store the result in `total_stamina_per_club`

input

Which Club's Players Exhibit Remarkable Stamina Levels?

Enter name of the club which has players with most stamina. If the answer is Vélez enter Velez.

input

Who is the player with most stamina in Club `Barcelona`

input

What is the best role of `Sergi Roberto`?

codevalidated

Calculate the average vision score for each position and Store the result in `avg_vision_per_position`

input

What is the average vision score for players in the `AM (C)` position?

Enter the value rounded off to two decimal points.

input

Who is the top player by Potential Ability in the Spanish First Division?

codevalidated

Calculate the average market value of players within each club and position combination

Store the result in the variable avg_market_value

codevalidated

Count the number of players within each nation and preferred foot combination

Store the result in player_counts_nation_pf

codevalidated

Calculate the mean value and maximum current ability of players within each club

Store the result in a dataframe named club_aggregations

codevalidated

Calculate Age Range by Nation

Create a custom function called age_range that computes the difference between the maximum and minimum ages. Apply this custom function using the agg() function to calculate the age range for each nation. Save the results in a dataframe named age_range_per_nation.

multiplechoice

What is the average wage of players in the `3. Liga`, the mean stamina of players in the `3F Superliga`, and the standard deviation of player stamina in the `Albanian Superleague`?

Find out the answers for the above questions and Select the correct answer from the options given below.

codevalidated

Calculate Average Value and Current Ability Variance by Club

Create a custom function called variance() that computes the variance of a series. Then, calculate the mean value and the variance of current ability for players within each club. Store the result in a dataframe named club_statistics.

codevalidated

Classify Players Based on Ability

Define a function player_type that classifies players as Star if their current ability exceeds 180 and their potential ability exceeds 190; otherwise, classify them as Regular and create a new column Player Type to store these classifications.

codevalidated

Categorize Players by Market Value

Create a function called categorize_by_value that categorizes players based on their market value into three categories: - High for values greater than 50,000,000 - Medium for values between 20,000,001 and 50,000,000 - Low for values of 20,000,000 or below Then, create a new column named Value Type to store these categories.

codevalidated

Categorize Players by Age

Create a function called categorize_by_age that classifies players into three age groups:

  • Young for ages below 25
  • Mid-age for ages between 25 and 29
  • Senior for ages 30 and above.

Then, create a new column named Age Group to store these classifications.

input

Who are the top 2 most valuable players in `1. FC Heidenheim 1846`?

Provide your answer in the format: Player1, Player2 (e.g., Lionel Messi, Cristiano Ronaldo).

codevalidated

Calculate BMI for Each Player

Define a function calculate_bmi that computes the Body Mass Index (BMI) of a player using their height and weight. First, convert the player's height from centimeters to meters. Then, apply the BMI formula: weight (kg) divided by height (m) squared. Create a new column BMI to store the calculated BMI values.

codevalidated

Rank Players by Market Value Within Each Nation

Use the groupby method to group players by their nation and then apply the transform method with a ranking function to assign a rank to each player's market value within their nation. The ranking is done in descending order, so the player with the highest value gets rank 1. Create a new column Value Rank to store these ranks.

codevalidated

Standardize Vision Ratings Within Each Club

Create a function named standardize that standardizes a series by subtracting the mean and dividing by the standard deviation. Apply this function to standardize the vision ratings within each column. Finally, add a new column named Standardized Vision to store the result.

codevalidated

Calculate Age Percentiles Within Each Club

Define a function named calculate_percentile to compute the percentile rank of each value in a series. Utilize this function to calculate the age percentile values within each club. Then, add a new column named Age Percentile to store these percentile ranks.

codevalidated

Calculate Deviation from Mean Pace Within Each Club

Create a function named deviation_from_mean to compute the deviation of each value from the mean. Utilize this function to calculate the mean pace deviation within each club. Finally, add a new column titled Pace Deviation to store the result.

codevalidated

Rank Players by Wage within Each Club

Create a function called rank_wage that sorts player wages in descending order. Apply this function to calculate the ranked wages within each club. Introduce a new column named Wage Rank to store these rankings.

Player Stats: Wrangling with Football DataPlayer Stats: Wrangling with Football Data
Project Created by

Lohith Unnam

This project is part of

Data Wrangling with Pandas

Explore other projects