You are on page 1of 43

Analysis of Market Value

of Football Players
Using Pandas

Mukta Joshi 220968052 DA FISAC


**Implementation included at the end of the report

Introduction
The objective of this report is to conduct a comprehensive
analysis of a dataset focusing on the relationship between player
market value and various categories, including Position,
Country, Age, Club, and specific Players. Additionally, a
comparative analysis will be performed on the two most
valuable players based on several parameters.
1. Dataset Overview: Before delving into specific analyses,
let's provide a general overview of the dataset:
2. Dataset Description: This file consists of data of Top 500
Most Expensive Footballer In 2021. The data is according
to the prices listed in transfer market along with data like
goals, assists, matches, age, etc.
3. Data Exploration: Data will be explored using various
libraries and graphs.
4. Data Cleaning: Data will be cleaned by removing missing
values, interpolation etc.

Insights on the analyzed data:


1)Position:
• Analyzing by general positions, we notice that the dataset
has a higher number of forwards, followed by midfielders
and defenders. The goalkeepers appear in a smaller
quantity.
• We can also observe that forwards are more valued,
followed by midfielders and defenders. Goalkeepers have a
significantly lower total market value. However, when we
look at the average, defenders are below goalkeepers.
• Analyzing specific positions within forwards, midfielders,
and defenders, we notice that we have many center-backs,
central midfielders, and center-forwards in the dataset. Due
to the higher quantity, these positions also have the highest
sum of market value.
• However, when we consider the average, left-wingers,
second strikers, and center-forwards have the highest value
index.
2)Country:
• England has the highest number of players in the dataset,
followed by France, Spain, Brazil, and Germany. These
same five countries have the highest total market value due
to having more players on the list.
• France and Norway have the highest maximum value, as
they have the two most valued players. Egypt has the same
maximum and minimum value, along with the highest
average value, because the country has only one player in
the list (Salah).
• Other countries have higher averages because they have
few players in the database, such as South Korea, Norway,
Slovakia, and Slovenia.
3)Age:
• Most of the players in the dataset are in the age range of 20
to 30 years.
• We have a higher number of players aged 24 (83 players),
followed by 25 years (53 players), and 26 years (51 players).
Due to the larger number of players in these age groups,
they have accumulated a higher total market value.
4)Clubs:
• As we have seen, there are multiple clubs in the dataset.
The ones with the highest number of players are as follows:
Manchester United (19 players), Manchester City (18
players), Paris Saint-Germain (16 players), Tottenham
Hotspur (16 players), Chelsea FC (16 players), and Real
Madrid (16 players).
• Manchester City leads in the total market value sum,
followed by Paris Saint-Germain, Manchester United,
Chelsea FC, and Bayern Munich.
• When we observe the average market value per club, we
notice that Manchester City, Bayern Munich, Paris Saint-
Germain, Inter Milan, and Liverpool have the highest
values, indicating how valuable the players of these teams
are.
5)Players:
• I analyzed the top 10 players with the highest market value
in the dataset. As we can see, Kylian Mbappé, Erling
Haaland, Harry Kane, Mohamed Salah, and Lukaku are
leading the list.
• Among these 10 players, 8 are forwards, while 2 are
midfielders. Additionally, we have 4 Centre-Forwards, 3
Left-Wingers, 1 Right-Winger, 1 Attacking Midfield, and 1
Center-Midfielder.
• Analyzing by club, we have two players from Manchester
City and two from Paris Saint-Germain among the top 10
most valued players. The other clubs have one player each.
The clubs are as follows: Borussia Dortmund, Tottenham
Hotspur, Liverpool FC, Chelsea FC, Manchester United,
and FC Barcelona.

Comparing the two most valuable players- Mbappe and


Haaland based on various parameters:
• We noticed that Kylian Mbappé is ahead of Erling Haaland
in terms of market value.
• When comparing goals and assists, we observed two
opposite dynamics: Mbappé had more assists, while
Haaland scored more goals. This same trend repeated for
the average goals per match and average assists per match.

Logs:
Time # Log Message
8.9s 1 <class 'pandas.core.frame.DataFrame'>
8.9s 2 RangeIndex: 500 entries, 0 to 499
8.9s 3 Data columns (total 15 columns):
8.9s 4 # Column Non-Null Count Dtype
8.9s 5 --- ------ -------------- -----
8.9s 6 0 Name 500 non-null object
8.9s 7 1 Position 500 non-null object
8.9s 8 2 Age 500 non-null int64
8.9s 9 3 Market_value 500 non-null float64
8.9s 10 4 Country 500 non-null object
8.9s 11 5 Club 500 non-null object
8.9s 12 6 Matches 500 non-null int64
8.9s 13 7 Goals 500 non-null int64
8.9s 14 8 Own_goals 500 non-null int64
8.9s 15 9 Assists 500 non-null int64
8.9s 16 10 Yellow_cards 500 non-null int64
8.9s 17 11 Second_yellow_cards 500 non-null int64
8.9s 18 12 Red_cards 500 non-null int64
8.9s 19 13 Substitute_in 500 non-null int64
Time # Log Message
8.9s 20 14 Substitute_out 500 non-null int64
8.9s 21 dtypes: float64(1), int64(10), object (4)
8.9s 22 memory usage: 58.7+ KB
9.0s 23 We have 500 rows and 15 columns
16.8s 24 /tmp/ipykernel_20/1149527092.py:2: UserWarning:
16.8s 25
16.8s 26 `distplot` is a deprecated function and will be removed in seaborn v0.14.0.
16.8s 27
16.8s 28 Please adapt your code to use either `displot` (a figure-level function with
16.8s 29 similar flexibility) or `histplot` (an axes-level function for histograms).
16.8s 30
16.8s 31 For a guide to updating your code to use the new functions, please see
16.8s 32 https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751
16.8s 33
16.8s 34 sns.distplot(data['Age'], hist=True, color='Blue')
/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930:
FutureWarning: --
32.5s 35 Exporter.preprocessors=["remove_papermill_header.RemovePapermillHeader"]
for containers is deprecated in traitlets 5.0. You can pass `--
Exporter.preprocessors item` ... multiple times to add items to a list.
32.5s 36 warn(
[NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not
32.5s 37
recognized by `NbConvertApp`.
32.5s 38 [NbConvertApp] Converting notebook __notebook__.ipynb to notebook
[NbConvertApp] ERROR | Notebook JSON is invalid: Additional properties are
32.6s 39
not allowed ('kernelspec', 'language_info' were unexpected)
32.6s 40
32.6s 41 Failed validating 'additionalProperties' in notebook:
32.6s 42
32.6s 43 On instance:
32.6s 44 {'cells': ['...97 cells...'],
32.6s 45 'kernelspec': {'display_name': 'Python 3',
32.6s 46 'language': 'python',
32.6s 47 'name': 'python3'},
32.6s 48 'language_info': {'codemirror_mode': {'name': 'ipython', 'version': 3},
32.6s 49 'file_extension': '.py',
32.6s 50 'mimetype': 'text/x-python',
32.6s 51 'name': 'python',
32.6s 52 'nbconvert_exporter': 'python',
32.6s 53 'pygments_lexer': 'ipython3',
32.6s 54 'version': '3.6.4'},
Time # Log Message
32.6s 55 'metadata': {'kernelspec': {'display_name': 'Python 3',
32.6s 56 'language': 'python',
32.6s 57 'name': 'python3'},
32.6s 58 'language_info': {'codemirror_mode': {'name': 'ipython',
32.6s 59 'version': 3},
32.6s 60 'file_extension': '.py',
32.6s 61 'mimetype': 'text/x-python',
32.6s 62 'name': 'python',
32.6s 63 'nbconvert_exporter': 'python',
32.6s 64 'pygments_lexer': 'ipython3',
32.6s 65 'version': '3.10.12'},
32.6s 66 'papermill': {'default_parameters': {},
32.6s 67 'duration': 27.99005,
32.6s 68 'end_time': '2023-09-12T21:19:32.692257',
32.6s 69 'environment_variables': {},
32.6s 70 'exception': None,
32.6s 71 'input_path': '__notebook__.ipynb',
32.6s 72 'output_path': '__notebook__.ipynb',
32.6s 73 'parameters': {},
32.6s 74 'start_time': '2023-09-12T21:19:04.702207',
32.6s 75 'version': '2.4.0'}},
32.6s 76 'nbformat': 4,
32.6s 77 'nbformat_minor': 5}
33.2s 78 [NbConvertApp] Writing 1189143 bytes to __notebook__.ipynb
/opt/conda/lib/python3.10/site-packages/traitlets/traitlets.py:2930:
FutureWarning: --
35.3s 79 Exporter.preprocessors=["nbconvert.preprocessors.ExtractOutputPreprocessor"]
for containers is deprecated in traitlets 5.0. You can pass `--
Exporter.preprocessors item` ... multiple times to add items to a list.
35.3s 80 warn(
[NbConvertApp] WARNING | Config option `kernel_spec_manager_class` not
35.3s 81
recognized by `NbConvertApp`.
35.3s 82 [NbConvertApp] Converting notebook __notebook__.ipynb to html
[NbConvertApp] ERROR | Notebook JSON is invalid: Additional properties are
35.4s 83
not allowed ('kernelspec', 'language_info' were unexpected)
35.4s 84
35.4s 85 Failed validating 'additionalProperties' in notebook:
35.4s 86
35.4s 87 On instance:
35.4s 88 {'cells': ['...97 cells...'],
35.4s 89 'kernelspec': {'display_name': 'Python 3',
Time # Log Message
35.4s 90 'language': 'python',
35.4s 91 'name': 'python3'},
35.4s 92 'language_info': {'codemirror_mode': {'name': 'ipython', 'version': 3},
35.4s 93 'file_extension': '.py',
35.4s 94 'mimetype': 'text/x-python',
35.4s 95 'name': 'python',
35.4s 96 'nbconvert_exporter': 'python',
35.4s 97 'pygments_lexer': 'ipython3',
35.4s 98 'version': '3.6.4'},
35.4s 99 'metadata': {'kernelspec': {'display_name': 'Python 3',
35.4s 100 'language': 'python',
35.4s 101 'name': 'python3'},
35.4s 102 'language_info': {'codemirror_mode': {'name': 'ipython',
35.4s 103 'version': 3},
35.4s 104 'file_extension': '.py',
35.4s 105 'mimetype': 'text/x-python',
35.4s 106 'name': 'python',
35.4s 107 'nbconvert_exporter': 'python',
35.4s 108 'pygments_lexer': 'ipython3',
35.4s 109 'version': '3.10.12'},
35.4s 110 'papermill': {'default_parameters': {},
35.4s 111 'duration': 27.99005,
35.4s 112 'end_time': '2023-09-12T21:19:32.692257',
35.4s 113 'environment_variables': {},
35.4s 114 'exception': None,
35.4s 115 'input_path': '__notebook__.ipynb',
35.4s 116 'output_path': '__notebook__.ipynb',
35.4s 117 'parameters': {},
35.4s 118 'start_time': '2023-09-12T21:19:04.702207',
35.4s 119 'version': '2.4.0'}},
35.4s 120 'nbformat': 4,
35.4s 121 'nbformat_minor': 5}
36.7s 122 [NbConvertApp] Support files will be in __results___files/
36.7s 123 [NbConvertApp] Making directory __results___files
36.7s 124 [NbConvertApp] Making directory __results___files
36.7s 125 [NbConvertApp] Making directory __results___files
36.7s 126 [NbConvertApp] Making directory __results___files
36.7s 127 [NbConvertApp] Making directory __results___files
36.7s 128 [NbConvertApp] Making directory __results___files
36.7s 129 [NbConvertApp] Making directory __results___files
Time # Log Message
36.7s 130 [NbConvertApp] Making directory __results___files
36.7s 131 [NbConvertApp] Making directory __results___files
36.7s 132 [NbConvertApp] Making directory __results___files
36.7s 133 [NbConvertApp] Making directory __results___files
36.7s 134 [NbConvertApp] Making directory __results___files
36.7s 135 [NbConvertApp] Making directory __results___files
36.7s 136 [NbConvertApp] Making directory __results___files
36.7s 137 [NbConvertApp] Making directory __results___files
36.7s 138 [NbConvertApp] Making directory __results___files
36.7s 139 [NbConvertApp] Making directory __results___files
36.7s 140 [NbConvertApp] Making directory __results___files
36.7s 141 [NbConvertApp] Writing 456054 bytes to __results__.html
In [41]: import pandas as pd
import numpy as np
import seaborn as sns
import matplotlib.pyplot as plt

In [42]: import pandas as pd


data=pd.read_csv("players.csv")
data

Out[42]: Markey
Unnamed: Own
Name Position Age Value In Country Club Matches Goals Assists
0 Goals
Millions(£)

Kylian Centre- Paris Saint-


0 0 22 144.0 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 1 21 135.0 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 2 28 108.0 England 16 7 0 2
Kane Forward Hotspur

Jack Manchester
3 3 Left Winger 26 90.0 England 15 2 0 3
Grealish City

Mohamed Right Liverpool


4 4 29 90.0 Egypt 15 15 0 6
Salah Winger FC

... ... ... ... ... ... ... ... ... ... ... ...

Giorgian Clube de
Attacking
495 495 de 27 16.2 Uruguay Regatas do 0 0 0 0
Midfield
Arrascaeta Flamengo

Ayoze Second Leicester


496 496 28 16.2 Spain 8 1 0 3
Pérez Striker City

497 497 Alex Meret Goalkeeper 24 16.2 Italy SSC Napoli 5 0 0 0

Duje Centre- Olympique


498 498 25 16.2 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 499 27 16.2 Spain 15 3 0 1
Elustondo Back Sociedad

500 rows × 16 columns

In [43]: display(data.head())
display(data.tail())

Loading [MathJax]/extensions/Safe.js
Markey
Unnamed: Own Yell
Name Position Age Value In Country Club Matches Goals Assists
0 Goals Car
Millions(£)

Kylian Centre- Paris Saint-


0 0 22 144.0 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 1 21 135.0 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 2 28 108.0 England 16 7 0 2
Kane Forward Hotspur

Jack Left Manchester


3 3 26 90.0 England 15 2 0 3
Grealish Winger City

Mohamed Right Liverpool


4 4 29 90.0 Egypt 15 15 0 6
Salah Winger FC

Markey
Unnamed: Own
Name Position Age Value In Country Club Matches Goals Assists
0 Goals
Millions(£)

Clube de
Giorgian
Attacking Regatas
495 495 de 27 16.2 Uruguay 0 0 0 0
Midfield do
Arrascaeta
Flamengo

Ayoze Second Leicester


496 496 28 16.2 Spain 8 1 0 3
Pérez Striker City

SSC
497 497 Alex Meret Goalkeeper 24 16.2 Italy 5 0 0 0
Napoli

Duje Centre- Olympique


498 498 25 16.2 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 499 27 16.2 Spain 15 3 0 1
Elustondo Back Sociedad

In [44]: # renaming columns

data = data.rename(columns=
{'Markey Value In Millions(£)': 'Market_value','Own Goals': 'Own_goals',
'Yellow Cards': 'Yellow_cards','Second Yellow Cards': 'Second_yellow_cards'
'Red Cards': 'Red_cards', 'Number Of Substitute In': 'Substitute_in',
'Number Of Substitute Out': 'Substitute_out'})

In [46]: # dropping the Unnamed: 0 column

data.drop(columns=['Unnamed: 0'], axis=1, inplace=True)

In [47]: data.columns

Index(['Name', 'Position', 'Age', 'Market_value', 'Country', 'Club', 'Matches',


Out[47]:
'Goals', 'Own_goals', 'Assists', 'Yellow_cards', 'Second_yellow_cards',
'Red_cards', 'Substitute_in', 'Substitute_out'],
dtype='object')

In [48]: data.index

RangeIndex(start=0, stop=500, step=1)


Out[48]:

In [49]: data.info()

Loading [MathJax]/extensions/Safe.js
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 500 entries, 0 to 499
Data columns (total 15 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 500 non-null object
1 Position 500 non-null object
2 Age 500 non-null int64
3 Market_value 500 non-null float64
4 Country 500 non-null object
5 Club 500 non-null object
6 Matches 500 non-null int64
7 Goals 500 non-null int64
8 Own_goals 500 non-null int64
9 Assists 500 non-null int64
10 Yellow_cards 500 non-null int64
11 Second_yellow_cards 500 non-null int64
12 Red_cards 500 non-null int64
13 Substitute_in 500 non-null int64
14 Substitute_out 500 non-null int64
dtypes: float64(1), int64(10), object(4)
memory usage: 58.7+ KB

In [50]: data.dtypes

Name object
Out[50]:
Position object
Age int64
Market_value float64
Country object
Club object
Matches int64
Goals int64
Own_goals int64
Assists int64
Yellow_cards int64
Second_yellow_cards int64
Red_cards int64
Substitute_in int64
Substitute_out int64
dtype: object

In [51]: print("We have %0.f rows and %0.f columns"%(data.shape[0],data.shape[1]))

We have 500 rows and 15 columns

In [52]: data.describe()

Out[52]: Age Market_value Matches Goals Own_goals Assists Yellow_cards Second_yellow_c

count 500.000000 500.000000 500.000000 500.000000 500.000000 500.00000 500.000000 500.00

mean 24.968000 31.537800 12.396000 2.160000 0.030000 1.51200 1.592000 0.03

std 3.165916 17.577697 4.342453 2.880102 0.170758 1.85276 1.445585 0.18

min 16.000000 16.200000 0.000000 0.000000 0.000000 0.00000 0.000000 0.00

25% 23.000000 19.800000 10.000000 0.000000 0.000000 0.00000 0.000000 0.00

50% 25.000000 25.200000 13.000000 1.000000 0.000000 1.00000 1.000000 0.00

75% 27.000000 36.000000 16.000000 3.000000 0.000000 2.00000 2.000000 0.00

max 36.000000 144.000000 24.000000 23.000000 1.000000 12.00000 7.000000 1.00

In [53]: data.isnull()
Loading [MathJax]/extensions/Safe.js
Out[53]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yellow_cards

0 False False False False False False False False False False False

1 False False False False False False False False False False False

2 False False False False False False False False False False False

3 False False False False False False False False False False False

4 False False False False False False False False False False False

... ... ... ... ... ... ... ... ... ... ... ...

495 False False False False False False False False False False False

496 False False False False False False False False False False False

497 False False False False False False False False False False False

498 False False False False False False False False False False False

499 False False False False False False False False False False False

500 rows × 15 columns

In [54]: data.isna().sum()

# the dataset doesn´t have missing values

Name 0
Out[54]:
Position 0
Age 0
Market_value 0
Country 0
Club 0
Matches 0
Goals 0
Own_goals 0
Assists 0
Yellow_cards 0
Second_yellow_cards 0
Red_cards 0
Substitute_in 0
Substitute_out 0
dtype: int64

In [55]: data['Club'].unique()

Loading [MathJax]/extensions/Safe.js
array(['Paris Saint-Germain', 'Borussia Dortmund', 'Tottenham Hotspur',
Out[55]:
'Manchester City', 'Liverpool FC', 'Chelsea FC',
'Manchester United', 'FC Barcelona', 'Bayern Munich',
'Inter Milan', 'Atlético de Madrid', 'West Ham United',
'Real Sociedad', 'Juventus FC', 'SS Lazio', 'Real Madrid',
'Bayer 04 Leverkusen', 'Arsenal FC', 'Sevilla FC', 'SSC Napoli',
'Leicester City', 'Everton FC', 'AC Milan', 'Villarreal CF',
'ACF Fiorentina', 'RB Leipzig', 'AS Roma', 'Crystal Palace',
'Wolverhampton Wanderers', 'Valencia CF', 'Leeds United',
'LOSC Lille', 'Aston Villa', 'Olympique Lyon', 'OGC Nice',
'AS Monaco', 'Atalanta BC', 'US Sassuolo', 'Torino FC',
'Ajax Amsterdam', 'Brentford FC', 'Southampton FC',
'Newcastle United', 'VfL Wolfsburg', 'FC Porto',
'Olympique Marseille', 'Eintracht Frankfurt',
'Borussia Mönchengladbach', 'Watford FC', 'Stade Rennais FC',
'Clube de Regatas do Flamengo', 'VfB Stuttgart', 'Club Brugge KV',
'Sporting CP', 'Brighton & Hove Albion', 'Dynamo Kyiv',
'Athletic Bilbao', 'Real Betis Balompié', 'Zenit St. Petersburg',
'Burnley FC', 'SL Benfica', 'TSG 1899 Hoffenheim', 'Norwich City',
'PSV Eindhoven', 'KRC Genk', 'Club Atlético Vélez Sarsfield',
'Club Atlético River Plate', 'FC Metz', 'UC Sampdoria',
'Red Bull Salzburg', 'Bologna FC 1909', 'Shakhtar Donetsk',
'Cagliari Calcio', 'Getafe CF', 'Al-Rayyan SC', 'Rubin Kazan',
'Feyenoord Rotterdam', 'RCD Espanyol Barcelona', 'UD AlmerÃ\xada',
'Sheffield United', 'Celta de Vigo'], dtype=object)

In [56]: data.Club.nunique()

81
Out[56]:

In [57]: data.Country.unique()

array(['France', 'Norway', 'England', 'Egypt', 'Belgium', 'Brazil',


Out[57]:
'Netherlands', 'Portugal', 'Germany', 'Senegal', 'Korea, South',
'Spain', 'Argentina', 'Canada', 'Morocco', 'Italy', 'Serbia',
'Slovenia', 'Uruguay', 'Scotland', 'Nigeria', 'Slovakia', 'Poland',
"Cote d'Ivoire", 'Austria', 'United States', 'Turkey', 'Mexico',
'Croatia', 'Czech Republic', 'Algeria', 'Burkina Faso', 'Sweden',
'Ghana', 'Denmark', 'Jamaica', 'Colombia', 'Guinea', 'Switzerland',
'Ukraine', 'Russia', 'DR Congo', 'Hungary', 'Mali', 'Japan',
'Cameroon', 'Iran', 'Montenegro', 'Gabon', 'Albania', 'Zambia',
'The Gambia', 'Israel', 'Georgia', 'Venezuela', 'Wales', 'Peru'],
dtype=object)

In [58]: data.Country.nunique()

57
Out[58]:

In [59]: data.Position.unique()

array(['Centre-Forward', 'Left Winger', 'Right Winger',


Out[59]:
'Attacking Midfield', 'Central Midfield', 'Defensive Midfield',
'Right-Back', 'Centre-Back', 'Second Striker', 'Left-Back',
'Goalkeeper', 'Left Midfield', 'Right Midfield'], dtype=object)

In [60]: data.Position.nunique()

13
Out[60]:

In [61]: # Creating new categories for Position using np.where

data['New_Position'] = np.where((data['Position'] == 'Centre-Forward') |


(data['Position'] == 'Left Winger') |
Loading [MathJax]/extensions/Safe.js (data['Position'] == 'Right Winger')|
(data['Position'] == 'Second Striker'),'Attacker',
np.where((data['Position'] == 'Attacking Midfield') |
(data['Position'] == 'Central Midfield') |
(data['Position'] == 'Defensive Midfield') |
(data['Position'] == 'Left Midfield') |
(data['Position'] == 'Right Midfield'), 'Midfie
np.where(data['Position'] == 'Goalkeeper',
'Goalkeeper','Defender')))

data

Out[61]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yell

Kylian Centre- Paris Saint-


0 22 144.0 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 21 135.0 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 28 108.0 England 16 7 0 2
Kane Forward Hotspur

Jack Manchester
3 Left Winger 26 90.0 England 15 2 0 3
Grealish City

Mohamed Right Liverpool


4 29 90.0 Egypt 15 15 0 6
Salah Winger FC

... ... ... ... ... ... ... ... ... ... ...

Giorgian Clube de
Attacking
495 de 27 16.2 Uruguay Regatas do 0 0 0 0
Midfield
Arrascaeta Flamengo

Ayoze Second Leicester


496 28 16.2 Spain 8 1 0 3
Pérez Striker City

497 Alex Meret Goalkeeper 24 16.2 Italy SSC Napoli 5 0 0 0

Duje Centre- Olympique


498 25 16.2 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 27 16.2 Spain 15 3 0 1
Elustondo Back Sociedad

500 rows × 16 columns

In [62]: # converting Market_value from float to int

data['Market_value'] = data['Market_value'].astype(int)
data.Market_value.dtype

dtype('int32')
Out[62]:

In [64]: data

Loading [MathJax]/extensions/Safe.js
Out[64]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yell

Kylian Centre- Paris Saint-


0 22 144 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 21 135 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 28 108 England 16 7 0 2
Kane Forward Hotspur

Jack Manchester
3 Left Winger 26 90 England 15 2 0 3
Grealish City

Mohamed Right Liverpool


4 29 90 Egypt 15 15 0 6
Salah Winger FC

... ... ... ... ... ... ... ... ... ... ...

Giorgian Clube de
Attacking
495 de 27 16 Uruguay Regatas do 0 0 0 0
Midfield
Arrascaeta Flamengo

Ayoze Second Leicester


496 28 16 Spain 8 1 0 3
Pérez Striker City

497 Alex Meret Goalkeeper 24 16 Italy SSC Napoli 5 0 0 0

Duje Centre- Olympique


498 25 16 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 27 16 Spain 15 3 0 1
Elustondo Back Sociedad

500 rows × 16 columns

In [65]: # creating new columns

data['Goals.per.game'] = (data['Goals']/data['Matches']).round(2)
data['Assists.per.game'] = (data['Assists']/data['Matches']).round(2)
data

Loading [MathJax]/extensions/Safe.js
Out[65]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yell

Kylian Centre- Paris Saint-


0 22 144 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 21 135 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 28 108 England 16 7 0 2
Kane Forward Hotspur

Jack Manchester
3 Left Winger 26 90 England 15 2 0 3
Grealish City

Mohamed Right Liverpool


4 29 90 Egypt 15 15 0 6
Salah Winger FC

... ... ... ... ... ... ... ... ... ... ...

Giorgian Clube de
Attacking
495 de 27 16 Uruguay Regatas do 0 0 0 0
Midfield
Arrascaeta Flamengo

Ayoze Second Leicester


496 28 16 Spain 8 1 0 3
Pérez Striker City

497 Alex Meret Goalkeeper 24 16 Italy SSC Napoli 5 0 0 0

Duje Centre- Olympique


498 25 16 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 27 16 Spain 15 3 0 1
Elustondo Back Sociedad

500 rows × 18 columns

MARKET VALUE X CATEGORIES

1)POSITION
In [66]: data

Loading [MathJax]/extensions/Safe.js
Out[66]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yell

Kylian Centre- Paris Saint-


0 22 144 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 21 135 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 28 108 England 16 7 0 2
Kane Forward Hotspur

Jack Manchester
3 Left Winger 26 90 England 15 2 0 3
Grealish City

Mohamed Right Liverpool


4 29 90 Egypt 15 15 0 6
Salah Winger FC

... ... ... ... ... ... ... ... ... ... ...

Giorgian Clube de
Attacking
495 de 27 16 Uruguay Regatas do 0 0 0 0
Midfield
Arrascaeta Flamengo

Ayoze Second Leicester


496 28 16 Spain 8 1 0 3
Pérez Striker City

497 Alex Meret Goalkeeper 24 16 Italy SSC Napoli 5 0 0 0

Duje Centre- Olympique


498 25 16 Croatia 8 0 0 0
Caleta-Car Back Marseille

Aritz Centre- Real


499 27 16 Spain 15 3 0 1
Elustondo Back Sociedad

500 rows × 18 columns

In [67]: data.New_Position.value_counts()

Attacker 172
Out[67]:
Midfielder 169
Defender 140
Goalkeeper 19
Name: New_Position, dtype: int64

In [68]: plt.figure(figsize=(10,8))

sns.countplot(data=data, x='New_Position')

plt.title("Count of positions")

Text(0.5, 1.0, 'Count of positions')


Out[68]:

Loading [MathJax]/extensions/Safe.js
In [69]: x = data.groupby('New_Position').Market_value.sum().sort_values(ascending=False).head(10
x

New_Position
Out[69]:
Attacker 5706
Midfielder 5306
Defender 4031
Goalkeeper 582
Name: Market_value, dtype: int32

In [70]: # visualizing

plt.figure(figsize=(10,5))

plt.title("Sum of Market Value x Position")

sns.lineplot(data=x)

<Axes: title={'center': 'Sum of Market Value x Position'}, xlabel='New_Position', ylabel


Out[70]:
='Market_value'>

Loading [MathJax]/extensions/Safe.js
In [71]: y = data.groupby('New_Position').Market_value.mean().sort_values(ascending=False).head(1
y

New_Position
Out[71]:
Attacker 33.174419
Midfielder 31.396450
Goalkeeper 30.631579
Defender 28.792857
Name: Market_value, dtype: float64

In [72]: # visualizing

plt.figure(figsize=(10,5))

plt.title("Average of Market Value x Position")

sns.lineplot(data=y)

<Axes: title={'center': 'Average of Market Value x Position'}, xlabel='New_Position', yl


Out[72]:
abel='Market_value'>

Loading [MathJax]/extensions/Safe.js
In [73]: # which are the specific positions of the field that are most valued?

data.Position.value_counts()

Centre-Back 87
Out[73]:
Central Midfield 74
Centre-Forward 70
Right Winger 48
Left Winger 46
Attacking Midfield 41
Defensive Midfield 41
Right-Back 30
Left-Back 23
Goalkeeper 19
Second Striker 8
Left Midfield 8
Right Midfield 5
Name: Position, dtype: int64

In [74]: c=data.groupby('Position').Market_value.sum().sort_values(ascending = False)


c

Position
Out[74]:
Centre-Back 2557
Central Midfield 2401
Centre-Forward 2348
Left Winger 1632
Right Winger 1447
Attacking Midfield 1324
Defensive Midfield 1263
Right-Back 777
Left-Back 697
Goalkeeper 582
Second Striker 279
Left Midfield 213
Right Midfield 105
Name: Market_value, dtype: int32

In [75]: data.groupby('Position').Market_value.agg(['max', 'min']).sort_values(by=['max', 'min'],


Loading [MathJax]/extensions/Safe.js
Out[75]: max min

Position

Centre-Forward 144 16

Attacking Midfield 90 16

Left Winger 90 16

Right Winger 90 16

Central Midfield 81 16

Defensive Midfield 81 16

Centre-Back 67 16

Right-Back 67 16

Goalkeeper 63 16

Left-Back 63 16

In [77]: #visualizing

plt.figure(figsize=(8,5))

plt.title("Sum of Market Value x Position")

plt.xticks(rotation=90)

sns.lineplot(data=c)

<Axes: title={'center': 'Sum of Market Value x Position'}, xlabel='Position', ylabel='Ma


Out[77]:
rket_value'>

Loading [MathJax]/extensions/Safe.js
In [78]: data.groupby("Position").Market_value.mean().sort_values(ascending=False)

Position
Out[78]:
Left Winger 35.478261
Second Striker 34.875000
Centre-Forward 33.542857
Central Midfield 32.445946
Attacking Midfield 32.292683
Defensive Midfield 30.804878
Goalkeeper 30.631579
Left-Back 30.304348
Right Winger 30.145833
Centre-Back 29.390805
Left Midfield 26.625000
Right-Back 25.900000
Right Midfield 21.000000
Name: Market_value, dtype: float64

In [79]: plt.figure(figsize=(12, 8))


sns.barplot(data=data, x='Position', y='Market_value',errorbar=None)
plt.title('Average Market Value by Position')
sns.set_style("white")
plt.xticks(rotation=90)
plt.show()

Loading [MathJax]/extensions/Safe.js
COUNTRY
In [80]: data.Country.value_counts().head(10)

England 67
Out[80]:
France 58
Spain 52
Brazil 41
Germany 29
Portugal 26
Italy 26
Argentina 22
Netherlands 17
Belgium 14
Name: Country, dtype: int64

In [81]: data.groupby('Country').Market_value.sum().sort_values(ascending=False).head(10)

Loading [MathJax]/extensions/Safe.js
Country
Out[81]:
England 2227
France 1878
Spain 1556
Brazil 1263
Germany 999
Portugal 881
Italy 847
Argentina 645
Netherlands 565
Belgium 519
Name: Market_value, dtype: int32

In [82]: data.groupby('Country').Market_value.agg(['max', 'min']).sort_values(by=['max', 'min'],

Out[82]: max min

Country

France 144 16

Norway 135 16

England 108 16

Egypt 90 90

Belgium 90 16

Brazil 90 16

Netherlands 81 19

Germany 81 16

Portugal 81 16

Korea, South 76 76

In [83]: data.groupby('Country').Market_value.mean().sort_values(ascending = False).head(10)

Country
Out[83]:
Egypt 90.000000
Korea, South 76.000000
Slovenia 63.000000
Norway 62.333333
Slovakia 54.000000
Canada 47.000000
Morocco 37.250000
Belgium 37.071429
Ghana 36.000000
Senegal 35.000000
Name: Market_value, dtype: float64

In [84]: selected_countries = ['Slovenia', 'Norway', 'Slovakia', 'Canada', 'Marocco', 'Belgium',


counts = data[data['Country'].isin(selected_countries)]['Country'].value_counts()
counts

Belgium 14
Out[84]:
Senegal 6
Norway 3
Canada 2
Slovenia 1
Slovakia 1
Ghana 1
Name: Country, dtype: int64

Loading [MathJax]/extensions/Safe.js
In [85]: # visualizing

plt.figure(figsize=(12, 6))
sns.barplot(data=data, x='Country', y='Market_value',errorbar=None)
plt.title('Average Market Value by Country')
plt.xticks(rotation=90)
plt.show()

AGE
In [86]: data.Age.value_counts()

24 83
Out[86]:
25 53
26 51
23 46
27 42
28 42
21 37
22 36
29 35
30 24
20 15
19 13
31 8
18 6
33 3
32 2
34 1
36 1
17 1
16 1
Name: Age, dtype: int64
Loading [MathJax]/extensions/Safe.js
In [87]: plt.figure(figsize=(11,8))

sns.set_style("dark")

plt.title("Count of ages", fontsize=16)

plt.xlabel=("Age")

sns.countplot(data=data, x="Age", color='blue')

<Axes: title={'center': 'Count of ages'}, xlabel='Age', ylabel='count'>


Out[87]:

In [88]: plt.figure(figsize=(12, 8))


sns.distplot(data['Age'], hist=True, color='Blue')
plt.title("Density Plot of the Ages", fontsize=16)

C:\Users\vidyut\AppData\Local\Temp\ipykernel_13584\1149527092.py:2: UserWarning:

`distplot` is a deprecated function and will be removed in seaborn v0.14.0.

Please adapt your code to use either `displot` (a figure-level function with
similar flexibility) or `histplot` (an axes-level function for histograms).

For a guide to updating your code to use the new functions, please see
https://gist.github.com/mwaskom/de44147ed2974457ad6372750bbe5751

sns.distplot(data['Age'], hist=True, color='Blue')


Text(0.5, 1.0, 'Density Plot of the Ages')
Out[88]:

Loading [MathJax]/extensions/Safe.js
In [89]: # age x market value sum

data.groupby('Age').Market_value.sum().sort_values(ascending=False).head(10)

Age
Out[89]:
24 2526
26 1694
25 1409
28 1380
29 1350
22 1275
23 1271
27 1261
21 1185
30 729
Name: Market_value, dtype: int32

In [90]: # age x market value average

data.groupby('Age').Market_value.mean().sort_values(ascending=False).head(10)

Age
Out[90]:
34 72.000000
18 46.666667
36 40.000000
29 38.571429
22 35.416667
26 33.215686
28 32.857143
21 32.027027
33 31.333333
24 30.433735
Name: Market_value, dtype: float64

Loading [MathJax]/extensions/Safe.js
In [91]: plt.figure(figsize=(12,7))

plt.title("Age x Market Value x Position")

sns.scatterplot(data=data, x='Age', y='Market_value', hue='New_Position')

sns.set_style("darkgrid")

CLUBS
In [92]: data.Club.unique()

Loading [MathJax]/extensions/Safe.js
array(['Paris Saint-Germain', 'Borussia Dortmund', 'Tottenham Hotspur',
Out[92]:
'Manchester City', 'Liverpool FC', 'Chelsea FC',
'Manchester United', 'FC Barcelona', 'Bayern Munich',
'Inter Milan', 'Atlético de Madrid', 'West Ham United',
'Real Sociedad', 'Juventus FC', 'SS Lazio', 'Real Madrid',
'Bayer 04 Leverkusen', 'Arsenal FC', 'Sevilla FC', 'SSC Napoli',
'Leicester City', 'Everton FC', 'AC Milan', 'Villarreal CF',
'ACF Fiorentina', 'RB Leipzig', 'AS Roma', 'Crystal Palace',
'Wolverhampton Wanderers', 'Valencia CF', 'Leeds United',
'LOSC Lille', 'Aston Villa', 'Olympique Lyon', 'OGC Nice',
'AS Monaco', 'Atalanta BC', 'US Sassuolo', 'Torino FC',
'Ajax Amsterdam', 'Brentford FC', 'Southampton FC',
'Newcastle United', 'VfL Wolfsburg', 'FC Porto',
'Olympique Marseille', 'Eintracht Frankfurt',
'Borussia Mönchengladbach', 'Watford FC', 'Stade Rennais FC',
'Clube de Regatas do Flamengo', 'VfB Stuttgart', 'Club Brugge KV',
'Sporting CP', 'Brighton & Hove Albion', 'Dynamo Kyiv',
'Athletic Bilbao', 'Real Betis Balompié', 'Zenit St. Petersburg',
'Burnley FC', 'SL Benfica', 'TSG 1899 Hoffenheim', 'Norwich City',
'PSV Eindhoven', 'KRC Genk', 'Club Atlético Vélez Sarsfield',
'Club Atlético River Plate', 'FC Metz', 'UC Sampdoria',
'Red Bull Salzburg', 'Bologna FC 1909', 'Shakhtar Donetsk',
'Cagliari Calcio', 'Getafe CF', 'Al-Rayyan SC', 'Rubin Kazan',
'Feyenoord Rotterdam', 'RCD Espanyol Barcelona', 'UD AlmerÃ\xada',
'Sheffield United', 'Celta de Vigo'], dtype=object)

In [93]: top_20_clubs = data.Club.value_counts().head(20)


top_20_clubs

Manchester United 19
Out[93]:
Manchester City 18
Paris Saint-Germain 16
Tottenham Hotspur 16
Chelsea FC 16
Real Madrid 16
Liverpool FC 15
RB Leipzig 15
Atlético de Madrid 15
Arsenal FC 15
Bayern Munich 14
Juventus FC 13
AC Milan 13
Everton FC 13
Atalanta BC 12
Leicester City 12
Wolverhampton Wanderers 11
Borussia Dortmund 11
Aston Villa 11
FC Barcelona 11
Name: Club, dtype: int64

In [94]: # visualizing

plt.figure(figsize=(12, 8))

plt.title("Top 20 Clubs with most players in the dataset", fontsize=16)

sns.countplot(data=data, x='Club', order=top_20_clubs.index, palette='viridis')

plt.xticks(rotation=90)

plt.show()

Loading [MathJax]/extensions/Safe.js
In [95]: data.groupby('Club').Market_value.sum().sort_values(ascending = False).nlargest(20)

Club
Out[95]:
Manchester City 937
Paris Saint-Germain 772
Manchester United 754
Chelsea FC 704
Bayern Munich 683
Liverpool FC 677
Atlético de Madrid 615
Real Madrid 590
Tottenham Hotspur 530
FC Barcelona 448
Juventus FC 447
Borussia Dortmund 422
Arsenal FC 403
Leicester City 385
RB Leipzig 375
Inter Milan 373
AC Milan 354
SSC Napoli 351
Everton FC 316
Aston Villa 284
Name: Market_value, dtype: int32

In [96]: top_20_clubs_value = data.groupby('Club').Market_value.mean().sort_values(ascending = Fa


top_20_clubs_value
Loading [MathJax]/extensions/Safe.js
Club
Out[96]:
Manchester City 52.055556
Bayern Munich 48.785714
Paris Saint-Germain 48.250000
Inter Milan 46.625000
Liverpool FC 45.133333
Chelsea FC 44.000000
Atlético de Madrid 41.000000
FC Barcelona 40.727273
Manchester United 39.684211
Borussia Dortmund 38.363636
Real Madrid 36.875000
SSC Napoli 35.100000
Juventus FC 34.384615
Sevilla FC 33.666667
Tottenham Hotspur 33.125000
SS Lazio 33.000000
Bayer 04 Leverkusen 32.500000
Leicester City 32.083333
West Ham United 31.714286
Torino FC 31.000000
Name: Market_value, dtype: float64

In [97]: # visualizing

plt.figure(figsize=(12,8))

plt.title("Clubs with largest average of player market value")

sns.barplot(data=data, x='Club', y='Market_value', order=top_20_clubs_value.index)

sns.set_style("dark")

plt.xticks(rotation=90)

plt.legend()

No artists with labels found to put in legend. Note that artists whose label start with
an underscore are ignored when legend() is called with no argument.
<matplotlib.legend.Legend at 0x2251beef350>
Out[97]:

Loading [MathJax]/extensions/Safe.js
PLAYERS
In [98]: data.Name.unique()

Loading [MathJax]/extensions/Safe.js
array(['Kylian Mbappé', 'Erling Haaland', 'Harry Kane', 'Jack Grealish',
Out[98]:
'Mohamed Salah', 'Romelu Lukaku', 'Kevin De Bruyne', 'Neymar',
'Jadon Sancho', 'Frenkie de Jong', 'Bruno Fernandes',
'Joshua Kimmich', 'Raheem Sterling', 'Marcus Rashford',
'Sadio Mané', 'Heung-min Son', 'Pedri', 'Phil Foden',
'Lautaro MartÃ\xadnez', 'Marcos Llorente', 'Lionel Messi',
'Mason Mount', 'Trent Alexander-Arnold', 'Rúben Dias',
'Marquinhos', 'Jude Bellingham', 'João Félix', 'Alphonso Davies',
'Achraf Hakimi', 'Declan Rice', 'Rodri', 'Mikel Oyarzabal',
'Federico Chiesa', 'Matthijs de Ligt', 'Kai Havertz',
'Sergej Milinković-Savić', 'Bernardo Silva', 'Raphaël Varane',
'Serge Gnabry', 'Leon Goretzka', 'Jan Oblak', 'Casemiro',
'Florian Wirtz', 'Bukayo Saka', 'Federico Valverde',
'Gianluigi Donnarumma', 'Nicolò Barella', 'Andrew Robertson',
'Ansu Fati', 'Jules Koundé', 'Victor Osimhen', 'Gabriel Jesus',
'Dayot Upamecano', 'Alessandro Bastoni', 'Wilfred Ndidi',
'José MarÃ\xada Giménez', 'Fabinho', 'Milan Skriniar',
'Leroy Sané', 'Paul Pogba', 'Thibaut Courtois', 'Alisson', 'Koke',
'Robert Lewandowski', 'Eduardo Camavinga', 'Richarlison',
'Franck Kessié', 'Youri Tielemans', 'Kingsley Coman',
"N'Golo Kanté", 'João Cancelo', 'Timo Werner', 'Virgil van Dijk',
'Marco Verratti', 'Marc-André ter Stegen', 'David Alaba',
'Jamal Musiala', 'Mason Greenwood', 'Pau Torres', 'Ferran Torres',
'VinÃ\xadcius Júnior', 'DuÅ¡an Vlahovic', 'Theo Hernández',
'Christian Pulisic', 'James Maddison', 'Dani Olmo',
'Ferland Mendy', 'Ousmane Dembélé', 'Ederson', 'Paulo Dybala',
'Piotr Zielinski', 'Harry Maguire', 'Antoine Griezmann',
'Stefan de Vrij', 'Lorenzo Insigne', 'Kalidou Koulibaly',
'Christopher Nkunku', 'Reece James', 'Tanguy Ndombélé',
'Fabián Ruiz', 'Diogo Jota', 'Diego Carlos', 'Caglar Söyüncü',
'Hirving Lozano', 'Dominic Calvert-Lewin', 'Lorenzo Pellegrini',
'Lucas Hernández', 'Aymeric Laporte', 'Memphis Depay',
'Wilfried Zaha', 'Ã\uf181lvaro Morata', 'Jorginho',
'Mateo Kovacic', 'Cristiano Ronaldo', 'Giovanni Reyna',
'Moussa Diaby', 'Tomas Soucek', 'Rúben Neves', 'Luke Shaw',
'Riyad Mahrez', 'Nuno Mendes', 'Edmond Tapsoba',
'Aaron Wan-Bissaka', 'Wesley Fofana', 'Youssef En-Nesyri',
'Éder Militão', 'Nicolò Zaniolo', 'Carlos Soler',
'Kalvin Phillips', 'Alexander Isak', 'Mikel Merino', 'Ben White',
'Martin Ødegaard', 'Fikayo Tomori', 'Presnel Kimpembe',
'Ã\uf181ngel Correa', 'Rodrigo de Paul', 'Thomas Partey',
'Thomas Lemar', 'André Silva', 'Gerard Moreno',
'Raphaël Guerreiro', 'Pierre-Emile Höjbjerg', 'Marcelo Brozovic',
'Saúl ÑÃ\xadguez', 'Yannick Carrasco', 'Roberto Firmino',
'Luis Alberto', 'Ilkay Gündogan', 'Ismaël Bennacer',
'Tammy Abraham', 'Ben Chilwell', 'Hakim Ziyech', 'Ciro Immobile',
'Jonathan David', 'Pedro Neto', 'Douglas Luiz', 'Lucas Paquetá',
'Dejan Kulusevski', 'Amine Gouiri', 'Aurélien Tchouaméni',
'Rodrygo', 'Harvey Barnes', 'Houssem Aouar', 'Leon Bailey',
'Moise Kean', 'Arthur', 'Ibrahima Konaté', 'Cristian Romero',
'Benjamin Pavard', 'Nicolas Pépé', 'Emiliano BuendÃ\xada',
'Scott McTominay', 'Marco Asensio', 'Mario Hermoso', 'Angeliño',
'Robin Gosens', 'Manuel Locatelli', 'José GayÃ\xa0',
'Andreas Christensen', 'Anthony Martial', 'Domenico Berardi',
'Andrea Belotti', 'Niklas Süle', 'Wissam Ben Yedder',
'Lucas Digne', 'Emiliano MartÃ\xadnez', 'Antonio Rüdiger',
'Mauro Icardi', 'Ryan Gravenberch', 'Jordan Veretout',
'Duván Zapata', 'Raphinha', 'Callum Hudson-Odoi',
'Davinson Sánchez', 'Ollie Watkins', 'Naby Keïta',
'Kieran Tierney', 'Ivan Toney', 'Ante Rebic', 'James Ward-Prowse',
'Nathan Aké', 'Kurt Zouma', 'Marcel Sabitzer', 'Yéremy Pino',
'Bryan Gil', 'Bruno Guimarães', 'Matheus Cunha', 'Edouard Mendy',
'Curtis Jones', 'Sergiño Dest', 'Rodrigo Bentancur',
'Donyell Malen', 'Jarrod Bowen', 'Nikola Vlasic', 'Manuel Akanji',
Loading [MathJax]/extensions/Safe.js
'Allan Saint-Maximin', 'Joan Jordán', 'Renato Sanches',
'Gianluca Mancini', 'Joe Gomez', 'Tyrone Mings', 'Wout Weghorst',
'JoaquÃ\xadn Correa', 'Ricardo Pereira', 'Dele Alli',
'Ruslan Malinovskyi', 'Adama Traoré', 'John McGinn',
'Lucas Ocampos', 'John Stones', 'Adrien Rabiot',
'Leander Dendoncker', 'Matteo Politano', 'Hakan Calhanoglu',
'Jesús Corona', 'Luis Muriel', 'Kevin Volland', 'Thomas Müller',
'Georginio Wijnaldum', 'Toni Kroos', 'Benoît Badiashile',
'Maxence Lacroix', 'Boubacar Kamara', 'Emile Smith Rowe',
"Evan N'Dicka", 'Sven Botman', 'Boubakary Soumaré',
'Merih Demiral', 'Marcus Thuram', 'Florian Neuhaus',
'Aleksandr Golovin', 'Timothy Castagne', 'Patrik Schick',
'Nélson Semedo', 'Raúl Jiménez', 'Oleksandr Zinchenko',
'Kyle Walker', 'Ismaïla Sarr', 'Sandro Tonali', 'Denis Zakaria',
'Xaver Schlager', 'Lukas Klostermann', 'Sébastien Haller',
'Matthias Ginter', 'Thorgan Hazard', 'Jérémy Doku',
'Gabriel Barbosa', 'Konrad Laimer', 'Emre Can',
'Leonardo Spinazzola', 'Gavi', 'Ilaix Moriba',
'Silas Katompa Mvumpa', 'Antony', 'Roger Ibañez', 'Fábio Silva',
'Lisandro MartÃ\xadnez', 'Luis DÃ\xadaz', 'Ronald Araújo',
'Renan Lodi', 'Emerson Royal', 'Dominik Szoboszlai',
'Charles De Ketelaere', 'Gabriel', 'Pedro Gonçalves',
'Nikola Milenkovic', 'Ezri Konsa', 'Yves Bissouma', 'Maxi Gómez',
'Rafael Leão', 'Daichi Kamada', 'Arnaut Danjuma',
'André Zambo Anguissa', 'Robin Le Normand', 'Nordi Mukiele',
'Ben Godfrey', 'Noa Lang', 'Weston McKennie', 'Ridle Baku',
'Jonathan Ikoné', 'Jonathan Bamba', 'Saïd Benrahma',
'Donny van de Beek', 'Sergio Reguilón', 'Jason Denayer',
'Viktor Tsygankov', 'Davide Calabria', 'Daniel Podence',
'Iñaki Williams', 'Jan Bednarek', 'Abdou Diallo', 'Thilo Kehrer',
'Gonçalo Guedes', 'Nabil Fekir', 'Nico Elvedi', 'Mike Maignan',
'Sardar Azmoun', 'James Tarkowski', 'Iñigo MartÃ\xadnez',
'Remo Freuler', 'Lewis Dunk', 'Daniel Carvajal', 'Jordan Pickford',
'Conor Coady', 'Abdoulaye Doucouré', 'Michael Keane',
'Stefan Savic', 'Lucas Moura', 'Pablo Sarabia', 'Thiago',
'Pierre-Emerick Aubameyang', 'Eden Hazard', 'Karim Benzema',
'Nicolás González', 'Amadou Haidara', 'Rafa Silva', 'Otávio',
'Victor Lindelöf', 'Giovanni Di Lorenzo', 'Odilon Kossounou',
'Rayan Cherki', 'Brahim DÃ\xadaz', 'Mario Pasalic',
'Marten de Roon', 'Andrej Kramaric', 'Gabriel Martinelli',
'Dwight McNeil', 'Max Aarons', 'David Neres', 'Mattéo Guendouzi',
'Cody Gakpo', 'Matty Cash', 'Francisco Trincão',
'Marash Kumbulla', 'Sasa Kalajdzic', 'Patson Daka',
'Giovani Lo Celso', 'Guido RodrÃ\xadguez', 'Joe Willock',
'Todd Cantwell', 'Christoph Baumgartner', 'Malcom', 'Orel Mangala',
'Ramy Bensebaini', 'Steven Bergwijn', 'Kasper Dolberg',
'Paul Onuachu', 'Joachim Andersen', 'Dean Henderson', 'Alex Iwobi',
'Jonathan Tah', 'Alejandro Grimaldo', 'Fred', 'Patrick Bamford',
'Eric Dier', 'Leandro Paredes', 'Berat Djimsiti', 'Jesse Lingard',
'Danny Ings', 'Allan', 'Callum Wilson', 'Granit Xhaka',
'Alexandre Lacazette', 'João Palhinha', 'Yussuf Poulsen',
'Thiago Almada', 'Julián Ã\uf181lvarez', 'Sofiane Diop',
'Pape Sarr', 'Pedro Porro', 'Darwin Núñez', 'Illan Meslier',
'Mikkel Damsgaard', 'Karim Adeyemi', 'Enock Mwepu', 'Musa Barrow',
'Eberechi Eze', 'Eric GarcÃ\xada', 'Aaron Ramsdale',
'MartÃ\xadn Zubimendi', 'Samuel Chukwueze', 'Dodô',
'Manor Solomon', 'Marc Guehi', 'Hamed Junior Traorè',
'Yusuf Yazici', 'Tetê', 'Pablo Fornals', 'Alfonso Pedraza',
'Igor Zubeldia', 'Mason Holgate', 'Ché Adams', 'Gerson',
'Tyler Adams', 'Matteo Pessina', 'Takehiro Tomiyasu',
'Jeff Reine-Adélaïde', 'Dani Ceballos', 'Nahitan Nández',
'Gaetano Castrovilli', 'Kelechi Iheanacho', 'Mauro Arambarri',
'Yerry Mina', 'Marc Cucurella', 'Unai Simón', 'Luka Jovic',
'Alex Telles', 'Yeray Ã\uf181lvarez', 'Zeki Celik', 'Harry Winks',
Loading [MathJax]/extensions/Safe.js
'Diego Llorente', 'Juan Musso', 'Moussa Dembélé', 'André Gomes',
'Neal Maupay', 'Jérémie Boga', 'Ã\uf181lex Remiro',
'Bryan Cristante', 'Alessio Romagnoli', 'Julian Weigl',
'Arkadiusz Milik', 'Héctor BellerÃ\xadn', 'Julian Brandt',
'Tiemoué Bakayoko', 'Filip Kostic', 'Danilo', 'Bertrand Traoré',
'Erik Lamela', 'Emil Forsberg', 'Portu', 'Kieran Trippier',
'James RodrÃ\xadguez', 'Julian Draxler', 'Philippe Coutinho',
'Alex Sandro', 'Sergio Canales', 'Jordan Henderson',
'Ã\uf181ngel Di MarÃ\xada', 'Josko Gvardiol', 'Joakim Maehle',
'Maximilian Arnold', 'Mohamed Simakan', 'Rayan Aït Nouri',
'Amad Diallo', 'Tariq Lamptey', 'Noni Madueke',
'Khvicha Kvaratskhelia', 'Wendel', 'William Saliba',
'Marcos Senesi', 'Youssoufa Moukoko', 'Luiz Felipe',
'Nicolás De La Cruz', 'Ryan Sessegnon', 'Axel Disasi',
'Alexis Saelemaekers', 'Yangel Herrera', 'Cengiz Ãœnder',
'Kyle Walker-Peters', 'Noussair Mazraoui', 'Umar Sadiq',
'Sander Berge', 'Manuel Lazzari', 'Éverton', 'Daniel James',
'Lucas Torreira', 'Tom Davies', 'Renato Tapia', 'David Raya',
'Gregor Kobel', 'Wilmar Barrios', 'Gelson Martins', 'Rob Holding',
'Adam Armstrong', 'Giorgian de Arrascaeta', 'Ayoze Pérez',
'Alex Meret', 'Duje Caleta-Car', 'Aritz Elustondo'], dtype=object)

In [99]: # analyzing the top 10 players

top_10 = data.sort_values(ascending = False, by='Market_value').head(10)


top_10

Out[99]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yellow

Kylian Centre- Paris Saint-


0 22 144 France 16 7 0 11
Mbappé Forward Germain

Erling Centre- Borussia


1 21 135 Norway 10 13 0 4
Haaland Forward Dortmund

Harry Centre- Tottenham


2 28 108 England 16 7 0 2
Kane Forward Hotspur

Mohamed Right Liverpool


4 29 90 Egypt 15 15 0 6
Salah Winger FC

Romelu Centre- Chelsea


5 28 90 Belgium 11 4 0 1
Lukaku Forward FC

Kevin De Attacking Manchester


6 30 90 Belgium 14 3 0 1
Bruyne Midfield City

Left Paris Saint-


7 Neymar 29 90 Brazil 11 3 0 3
Winger Germain

Jack Left Manchester


3 26 90 England 15 2 0 3
Grealish Winger City

Jadon Left Manchester


8 21 81 England 13 0 0 0
Sancho Winger United

Frenkie Central FC
9 24 81 Netherlands 13 0 0 2
de Jong Midfield Barcelona

In [100… #visualizing

plt.figure(figsize=(10,7))

plt.title("Top 10 Players x Market Value")

sns.barplot(data=top_10, y="Name", x="Market_value")

sns.set_style("darkgrid")
Loading [MathJax]/extensions/Safe.js
In [101… # visualizing

plt.figure(figsize=(10,5))

plt.title("Market Value Comparision")

sns.barplot(x='Name', y='Market_value', hue='Position', data=top_10)

plt.xticks(rotation=90)

plt.legend()

<matplotlib.legend.Legend at 0x2251d27dbd0>
Out[101]:

Loading [MathJax]/extensions/Safe.js
In [102… plt.figure(figsize=(10,8))

plt.title("Players x Position x Market Value")

plt.xticks(rotation=90)

sns.set_style("dark")

sns.barplot(x='Name', y='Market_value', hue='New_Position', data=top_10, palette='Blues_

<Axes: title={'center': 'Players x Position x Market Value'}, xlabel='Name', ylabel='Ma


Out[102]:
rket_value'>

Loading [MathJax]/extensions/Safe.js
In [103… data.groupby(['Name', 'Club']).Market_value.sum().sort_values(ascending = False).nlarges

Name Club
Out[103]:
Kylian Mbappé Paris Saint-Germain 144
Erling Haaland Borussia Dortmund 135
Harry Kane Tottenham Hotspur 108
Neymar Paris Saint-Germain 90
Jack Grealish Manchester City 90
Mohamed Salah Liverpool FC 90
Romelu Lukaku Chelsea FC 90
Kevin De Bruyne Manchester City 90
Frenkie de Jong FC Barcelona 81
Bruno Fernandes Manchester United 81
Name: Market_value, dtype: int32

In [104… # visualizing

plt.figure(figsize=(12,10))

plt.title("Players x Position x Market Value")

plt.xticks(rotation=90)

sns.set_style("dark")
Loading [MathJax]/extensions/Safe.js
sns.barplot(x='Name', y='Market_value', hue='Club', data=top_10)

<Axes: title={'center': 'Players x Position x Market Value'}, xlabel='Name', ylabel='Ma


Out[104]:
rket_value'>

COMPARING MBAPPE AND HAALAND


In [106… top_2 = data[data['Name'].isin(['Erling Haaland', 'Kylian Mbappé'])]
top_2

Out[106]: Name Position Age Market_value Country Club Matches Goals Own_goals Assists Yellow_ca

Paris
Kylian Centre-
0 22 144 France Saint- 16 7 0 11
Mbappé Forward
Germain

Erling Centre- Borussia


1 21 135 Norway 10 13 0 4
Haaland Forward Dortmund

In [107… # visualizing
Loading [MathJax]/extensions/Safe.js
plt.figure(figsize=(10,5))

plt.title("Market Value Comparision")

sns.set_style("darkgrid")

sns.barplot(y='Name', x='Market_value', data=top_2, color='blue', alpha=0.6, label='Mark

<Axes: title={'center': 'Market Value Comparision'}, xlabel='Market_value', ylabel='Nam


Out[107]:
e'>

In [108… # visualizing

plt.figure(figsize=(10,5))

plt.title("Goals x Assists")

sns.barplot(x='Name', y='Goals', data=top_2, color='blue', alpha=0.6, label='Goals')

sns.lineplot(data=top_2['Assists'], color='blue', alpha=0.2, marker='o', label='Assists'

plt.grid(True, axis='y', linestyle='--', alpha=1.0)

sns.set_style("dark")

plt.legend()

plt.show()

Loading [MathJax]/extensions/Safe.js
In [109… # visualizing

plt.figure(figsize=(10,5))

plt.title("Avg Goals x Avg Assists")

sns.barplot(x='Name', y='Goals.per.game', data=top_2, color='blue', alpha=0.6, label='Av

sns.lineplot(data=top_2['Assists.per.game'], color='blue', alpha=0.2, marker='o', label=

plt.grid(True, axis='y', linestyle='--', alpha=0.7)

sns.set_style("white")

plt.legend()

plt.show()

Loading [MathJax]/extensions/Safe.js
In [ ]:

Loading [MathJax]/extensions/Safe.js

You might also like