Statement of Completion#6bbacc7f
Intro to Pandas for Data Analysis
easy
Practicing Filtering and Selection with FIFA data
Resolution
Activities
Project.ipynb
In [1]:
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
In [2]:
df = pd.read_csv('players_22.csv',dtype={25: str, 108: str})
Let's Analyze our DataFrame¶
we will see the first few rows of the dataframe using df.head()
, if we want to check the last few rows then we will use df.tail()
,
After that, we will check the names of columns using df.columns
, check the datatype, and values in each column using df.info()
.
Lastly, to find the statistical features we use df.describe()
.
In [3]:
df.head()
Out[3]:
sofifa_id | player_url | short_name | long_name | player_positions | overall | potential | value_eur | wage_eur | age | ... | lcb | cb | rcb | rb | gk | player_face_url | club_logo_url | club_flag_url | nation_logo_url | nation_flag_url | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 158023 | https://sofifa.com/player/158023/lionel-messi/... | L. Messi | Lionel Andrés Messi Cuccittini | RW, ST, CF | 93 | 93 | 78000000.0 | 320000.0 | 34 | ... | 50+3 | 50+3 | 50+3 | 61+3 | 19+3 | https://cdn.sofifa.net/players/158/023/22_120.png | https://cdn.sofifa.net/teams/73/60.png | https://cdn.sofifa.net/flags/fr.png | https://cdn.sofifa.net/teams/1369/60.png | https://cdn.sofifa.net/flags/ar.png |
1 | 188545 | https://sofifa.com/player/188545/robert-lewand... | R. Lewandowski | Robert Lewandowski | ST | 92 | 92 | 119500000.0 | 270000.0 | 32 | ... | 60+3 | 60+3 | 60+3 | 61+3 | 19+3 | https://cdn.sofifa.net/players/188/545/22_120.png | https://cdn.sofifa.net/teams/21/60.png | https://cdn.sofifa.net/flags/de.png | https://cdn.sofifa.net/teams/1353/60.png | https://cdn.sofifa.net/flags/pl.png |
2 | 20801 | https://sofifa.com/player/20801/c-ronaldo-dos-... | Cristiano Ronaldo | Cristiano Ronaldo dos Santos Aveiro | ST, LW | 91 | 91 | 45000000.0 | 270000.0 | 36 | ... | 53+3 | 53+3 | 53+3 | 60+3 | 20+3 | https://cdn.sofifa.net/players/020/801/22_120.png | https://cdn.sofifa.net/teams/11/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1354/60.png | https://cdn.sofifa.net/flags/pt.png |
3 | 190871 | https://sofifa.com/player/190871/neymar-da-sil... | Neymar Jr | Neymar da Silva Santos Júnior | LW, CAM | 91 | 91 | 129000000.0 | 270000.0 | 29 | ... | 50+3 | 50+3 | 50+3 | 62+3 | 20+3 | https://cdn.sofifa.net/players/190/871/22_120.png | https://cdn.sofifa.net/teams/73/60.png | https://cdn.sofifa.net/flags/fr.png | NaN | https://cdn.sofifa.net/flags/br.png |
4 | 192985 | https://sofifa.com/player/192985/kevin-de-bruy... | K. De Bruyne | Kevin De Bruyne | CM, CAM | 91 | 91 | 125500000.0 | 350000.0 | 30 | ... | 69+3 | 69+3 | 69+3 | 75+3 | 21+3 | https://cdn.sofifa.net/players/192/985/22_120.png | https://cdn.sofifa.net/teams/10/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1325/60.png | https://cdn.sofifa.net/flags/be.png |
5 rows × 110 columns
In [4]:
df.columns
Out[4]:
Index(['sofifa_id', 'player_url', 'short_name', 'long_name', 'player_positions', 'overall', 'potential', 'value_eur', 'wage_eur', 'age', ... 'lcb', 'cb', 'rcb', 'rb', 'gk', 'player_face_url', 'club_logo_url', 'club_flag_url', 'nation_logo_url', 'nation_flag_url'], dtype='object', length=110)
In [5]:
df.info()
<class 'pandas.core.frame.DataFrame'> RangeIndex: 19239 entries, 0 to 19238 Columns: 110 entries, sofifa_id to nation_flag_url dtypes: float64(16), int64(44), object(50) memory usage: 16.1+ MB
In [6]:
df.describe()
Out[6]:
sofifa_id | overall | potential | value_eur | wage_eur | age | height_cm | weight_kg | club_team_id | league_level | ... | mentality_composure | defending_marking_awareness | defending_standing_tackle | defending_sliding_tackle | goalkeeping_diving | goalkeeping_handling | goalkeeping_kicking | goalkeeping_positioning | goalkeeping_reflexes | goalkeeping_speed | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
count | 19239.000000 | 19239.000000 | 19239.000000 | 1.916500e+04 | 19178.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19178.000000 | 19178.000000 | ... | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 19239.000000 | 2132.000000 |
mean | 231468.086959 | 65.772182 | 71.079370 | 2.850452e+06 | 9017.989363 | 25.210822 | 181.299704 | 74.943032 | 50580.498123 | 1.354364 | ... | 57.929830 | 46.601746 | 48.045584 | 45.906700 | 16.406102 | 16.192474 | 16.055356 | 16.229274 | 16.491814 | 36.439962 |
std | 27039.717497 | 6.880232 | 6.086213 | 7.613700e+06 | 19470.176724 | 4.748235 | 6.863179 | 7.069434 | 54401.868535 | 0.747865 | ... | 12.159326 | 20.200807 | 21.232718 | 20.755683 | 17.574028 | 16.839528 | 16.564554 | 17.059779 | 17.884833 | 10.751563 |
min | 41.000000 | 47.000000 | 49.000000 | 9.000000e+03 | 500.000000 | 16.000000 | 155.000000 | 49.000000 | 1.000000 | 1.000000 | ... | 12.000000 | 4.000000 | 5.000000 | 5.000000 | 2.000000 | 2.000000 | 2.000000 | 2.000000 | 2.000000 | 15.000000 |
25% | 214413.500000 | 61.000000 | 67.000000 | 4.750000e+05 | 1000.000000 | 21.000000 | 176.000000 | 70.000000 | 479.000000 | 1.000000 | ... | 50.000000 | 29.000000 | 28.000000 | 25.000000 | 8.000000 | 8.000000 | 8.000000 | 8.000000 | 8.000000 | 27.000000 |
50% | 236543.000000 | 66.000000 | 71.000000 | 9.750000e+05 | 3000.000000 | 25.000000 | 181.000000 | 75.000000 | 1938.000000 | 1.000000 | ... | 59.000000 | 52.000000 | 56.000000 | 53.000000 | 11.000000 | 11.000000 | 11.000000 | 11.000000 | 11.000000 | 36.000000 |
75% | 253532.500000 | 70.000000 | 75.000000 | 2.000000e+06 | 8000.000000 | 29.000000 | 186.000000 | 80.000000 | 111139.000000 | 1.000000 | ... | 66.000000 | 63.000000 | 65.000000 | 63.000000 | 14.000000 | 14.000000 | 14.000000 | 14.000000 | 14.000000 | 45.000000 |
max | 264640.000000 | 93.000000 | 95.000000 | 1.940000e+08 | 350000.000000 | 54.000000 | 206.000000 | 110.000000 | 115820.000000 | 5.000000 | ... | 96.000000 | 93.000000 | 93.000000 | 92.000000 | 91.000000 | 92.000000 | 93.000000 | 92.000000 | 90.000000 | 65.000000 |
8 rows × 60 columns
Some visualizations to better understand the dataset¶
In [7]:
df['age'].plot(kind='hist', figsize=(10, 8))
Out[7]:
<Axes: ylabel='Frequency'>
In [8]:
df['overall'].plot(kind='box', vert=False, figsize=(10, 5))
Out[8]:
<Axes: >
In [9]:
sns.distplot(df['age']);
/tmp/ipykernel_18/1462740167.py:1: 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(df['age']);
In [10]:
df['international_reputation'].value_counts().plot(kind='pie', autopct='%1.1f%%', cmap='Set3', figsize=(10, 8))
Out[10]:
<Axes: ylabel='count'>
In [11]:
df['nationality_name'].value_counts().head(10).plot(kind='pie', autopct='%1.1f%%', cmap='Set3', figsize=(10, 8))
Out[11]:
<Axes: ylabel='count'>
In [12]:
df['work_rate'].value_counts().plot(kind='pie', autopct='%1.1f%%', cmap='Set3', figsize=(10, 8))
Out[12]:
<Axes: ylabel='count'>
Filtering¶
Below we will do some basic as well as advance filtering on our FIFA Players 22 dataset.
1. Select all the rows and the first 5 columns from the dataframe and store the result in the variable df_first_five_cols
In [19]:
df_first_five_cols = df.iloc[:, 0:5]
In [20]:
df_first_five_cols
Out[20]:
sofifa_id | player_url | short_name | long_name | player_positions | |
---|---|---|---|---|---|
0 | 158023 | https://sofifa.com/player/158023/lionel-messi/... | L. Messi | Lionel Andrés Messi Cuccittini | RW, ST, CF |
1 | 188545 | https://sofifa.com/player/188545/robert-lewand... | R. Lewandowski | Robert Lewandowski | ST |
2 | 20801 | https://sofifa.com/player/20801/c-ronaldo-dos-... | Cristiano Ronaldo | Cristiano Ronaldo dos Santos Aveiro | ST, LW |
3 | 190871 | https://sofifa.com/player/190871/neymar-da-sil... | Neymar Jr | Neymar da Silva Santos Júnior | LW, CAM |
4 | 192985 | https://sofifa.com/player/192985/kevin-de-bruy... | K. De Bruyne | Kevin De Bruyne | CM, CAM |
... | ... | ... | ... | ... | ... |
19234 | 261962 | https://sofifa.com/player/261962/defu-song/220002 | Song Defu | 宋德福 | CDM |
19235 | 262040 | https://sofifa.com/player/262040/caoimhin-port... | C. Porter | Caoimhin Porter | CM |
19236 | 262760 | https://sofifa.com/player/262760/nathan-logue/... | N. Logue | Nathan Logue-Cunningham | CM |
19237 | 262820 | https://sofifa.com/player/262820/luke-rudden/2... | L. Rudden | Luke Rudden | ST |
19238 | 264540 | https://sofifa.com/player/264540/emanuel-lalch... | E. Lalchhanchhuaha | Emanuel Lalchhanchhuaha | CAM |
19239 rows × 5 columns
2. Select Specific Columns in a Custom Order
In [23]:
df_order_cols = df.iloc[:, [3,6,4,1]]
df_order_cols
Out[23]:
long_name | potential | player_positions | player_url | |
---|---|---|---|---|
0 | Lionel Andrés Messi Cuccittini | 93 | RW, ST, CF | https://sofifa.com/player/158023/lionel-messi/... |
1 | Robert Lewandowski | 92 | ST | https://sofifa.com/player/188545/robert-lewand... |
2 | Cristiano Ronaldo dos Santos Aveiro | 91 | ST, LW | https://sofifa.com/player/20801/c-ronaldo-dos-... |
3 | Neymar da Silva Santos Júnior | 91 | LW, CAM | https://sofifa.com/player/190871/neymar-da-sil... |
4 | Kevin De Bruyne | 91 | CM, CAM | https://sofifa.com/player/192985/kevin-de-bruy... |
... | ... | ... | ... | ... |
19234 | 宋德福 | 52 | CDM | https://sofifa.com/player/261962/defu-song/220002 |
19235 | Caoimhin Porter | 59 | CM | https://sofifa.com/player/262040/caoimhin-port... |
19236 | Nathan Logue-Cunningham | 55 | CM | https://sofifa.com/player/262760/nathan-logue/... |
19237 | Luke Rudden | 60 | ST | https://sofifa.com/player/262820/luke-rudden/2... |
19238 | Emanuel Lalchhanchhuaha | 60 | CAM | https://sofifa.com/player/264540/emanuel-lalch... |
19239 rows × 4 columns
In [ ]:
3. Filter out 50 rows from the Colum number 3,6,4,1 into the variable fifty_rows
In [26]:
fifty_rows = df_order_cols.iloc[0:50, :]
fifty_rows
Out[26]:
long_name | potential | player_positions | player_url | |
---|---|---|---|---|
0 | Lionel Andrés Messi Cuccittini | 93 | RW, ST, CF | https://sofifa.com/player/158023/lionel-messi/... |
1 | Robert Lewandowski | 92 | ST | https://sofifa.com/player/188545/robert-lewand... |
2 | Cristiano Ronaldo dos Santos Aveiro | 91 | ST, LW | https://sofifa.com/player/20801/c-ronaldo-dos-... |
3 | Neymar da Silva Santos Júnior | 91 | LW, CAM | https://sofifa.com/player/190871/neymar-da-sil... |
4 | Kevin De Bruyne | 91 | CM, CAM | https://sofifa.com/player/192985/kevin-de-bruy... |
5 | Jan Oblak | 93 | GK | https://sofifa.com/player/200389/jan-oblak/220002 |
6 | Kylian Mbappé Lottin | 95 | ST, LW | https://sofifa.com/player/231747/kylian-mbappe... |
7 | Manuel Peter Neuer | 90 | GK | https://sofifa.com/player/167495/manuel-neuer/... |
8 | Marc-André ter Stegen | 92 | GK | https://sofifa.com/player/192448/marc-andre-te... |
9 | Harry Kane | 90 | ST | https://sofifa.com/player/202126/harry-kane/22... |
10 | N'Golo Kanté | 90 | CDM, CM | https://sofifa.com/player/215914/ngolo-kante/2... |
11 | Karim Benzema | 89 | CF, ST | https://sofifa.com/player/165153/karim-benzema... |
12 | Thibaut Courtois | 91 | GK | https://sofifa.com/player/192119/thibaut-court... |
13 | 손흥민 孙兴慜 | 89 | LM, CF, LW | https://sofifa.com/player/200104/heung-min-son... |
14 | Carlos Henrique Venancio Casimiro | 89 | CDM | https://sofifa.com/player/200145/carlos-henriq... |
15 | Virgil van Dijk | 89 | CB | https://sofifa.com/player/203376/virgil-van-di... |
16 | Sadio Mané | 89 | LW | https://sofifa.com/player/208722/sadio-mane/22... |
17 | Mohamed Salah Ghaly | 89 | RW | https://sofifa.com/player/209331/mohamed-salah... |
18 | Ederson Santana de Moraes | 91 | GK | https://sofifa.com/player/210257/ederson-santa... |
19 | Joshua Walter Kimmich | 90 | CDM, RB | https://sofifa.com/player/212622/joshua-kimmic... |
20 | Alisson Ramsés Becker | 90 | GK | https://sofifa.com/player/212831/alisson-ramse... |
21 | Gianluigi Donnarumma | 93 | GK | https://sofifa.com/player/230621/gianluigi-don... |
22 | Sergio Ramos García | 88 | CB | https://sofifa.com/player/155862/sergio-ramos-... |
23 | Luis Alberto Suárez Díaz | 88 | ST | https://sofifa.com/player/176580/luis-suarez/2... |
24 | Toni Kroos | 88 | CM | https://sofifa.com/player/182521/toni-kroos/22... |
25 | Romelu Lukaku Menama | 88 | ST | https://sofifa.com/player/192505/romelu-lukaku... |
26 | Keylor Navas Gamboa | 88 | GK | https://sofifa.com/player/193041/keylor-navas/... |
27 | Raheem Sterling | 89 | LW, RW | https://sofifa.com/player/202652/raheem-sterli... |
28 | Bruno Miguel Borges Fernandes | 89 | CAM | https://sofifa.com/player/212198/bruno-miguel-... |
29 | Erling Braut Haaland | 93 | ST | https://sofifa.com/player/239085/erling-haalan... |
30 | Sergio Leonel Agüero del Castillo | 87 | ST | https://sofifa.com/player/153079/sergio-aguero... |
31 | Hugo Lloris | 87 | GK | https://sofifa.com/player/167948/hugo-lloris/2... |
32 | Luka Modrić | 87 | CM | https://sofifa.com/player/177003/luka-modric/2... |
33 | Ángel Fabián Di María Hernández | 87 | RW, LW | https://sofifa.com/player/183898/angel-di-mari... |
34 | Wojciech Tomasz Szczęsny | 87 | GK | https://sofifa.com/player/186153/wojciech-szcz... |
35 | Thomas Müller | 87 | CAM, RM, RW | https://sofifa.com/player/189596/thomas-muller... |
36 | Ciro Immobile | 87 | ST | https://sofifa.com/player/192387/ciro-immobile... |
37 | Paul Pogba | 87 | CM, LM | https://sofifa.com/player/195864/paul-pogba/22... |
38 | Marco Verratti | 87 | CM, CAM | https://sofifa.com/player/199556/marco-verratt... |
39 | Marcos Aoás Corrêa | 90 | CB, CDM | https://sofifa.com/player/207865/marcos-aoas-c... |
40 | Leon Christoph Goretzka | 88 | CM, CDM | https://sofifa.com/player/209658/leon-goretzka... |
41 | Paulo Bruno Exequiel Dybala | 88 | CF, CAM | https://sofifa.com/player/211110/paulo-dybala/... |
42 | Andrew Robertson | 88 | LB | https://sofifa.com/player/216267/andrew-robert... |
43 | Frenkie de Jong | 92 | CM, CDM, CB | https://sofifa.com/player/228702/frenkie-de-jo... |
44 | Trent Alexander-Arnold | 92 | RB | https://sofifa.com/player/231281/trent-alexand... |
45 | Jadon Sancho | 91 | RM, CF, LM | https://sofifa.com/player/233049/jadon-sancho/... |
46 | Rúben dos Santos Gato Alves Dias | 91 | CB | https://sofifa.com/player/239818/ruben-santos-... |
47 | Giorgio Chiellini | 86 | CB | https://sofifa.com/player/138956/giorgio-chiel... |
48 | Samir Handanovič | 86 | GK | https://sofifa.com/player/162835/samir-handano... |
49 | Mats Hummels | 86 | CB | https://sofifa.com/player/178603/mats-hummels/... |
In [ ]:
4. Select the all rows and the Columns ['short_name','age','player_positions', 'overall', 'value_eur']
from the dataframe and store your selection in the variable named_cols
In [28]:
named_cols= df.loc[:, ['short_name','age','player_positions', 'overall', 'value_eur']]
In [29]:
named_cols
Out[29]:
short_name | age | player_positions | overall | value_eur | |
---|---|---|---|---|---|
0 | L. Messi | 34 | RW, ST, CF | 93 | 78000000.0 |
1 | R. Lewandowski | 32 | ST | 92 | 119500000.0 |
2 | Cristiano Ronaldo | 36 | ST, LW | 91 | 45000000.0 |
3 | Neymar Jr | 29 | LW, CAM | 91 | 129000000.0 |
4 | K. De Bruyne | 30 | CM, CAM | 91 | 125500000.0 |
... | ... | ... | ... | ... | ... |
19234 | Song Defu | 22 | CDM | 47 | 70000.0 |
19235 | C. Porter | 19 | CM | 47 | 110000.0 |
19236 | N. Logue | 21 | CM | 47 | 100000.0 |
19237 | L. Rudden | 19 | ST | 47 | 110000.0 |
19238 | E. Lalchhanchhuaha | 19 | CAM | 47 | 110000.0 |
19239 rows × 5 columns
5. Filter out the first 14 rows and the Columns ['short_name','age','player_positions', 'overall', 'value_eur']
from the dataframe and store the result in the variable named_cols_rows
In [31]:
named_cols_rows = named_cols.iloc[0:14, :]
In [32]:
named_cols_rows
Out[32]:
short_name | age | player_positions | overall | value_eur | |
---|---|---|---|---|---|
0 | L. Messi | 34 | RW, ST, CF | 93 | 78000000.0 |
1 | R. Lewandowski | 32 | ST | 92 | 119500000.0 |
2 | Cristiano Ronaldo | 36 | ST, LW | 91 | 45000000.0 |
3 | Neymar Jr | 29 | LW, CAM | 91 | 129000000.0 |
4 | K. De Bruyne | 30 | CM, CAM | 91 | 125500000.0 |
5 | J. Oblak | 28 | GK | 91 | 112000000.0 |
6 | K. Mbappé | 22 | ST, LW | 91 | 194000000.0 |
7 | M. Neuer | 35 | GK | 90 | 13500000.0 |
8 | M. ter Stegen | 29 | GK | 90 | 99000000.0 |
9 | H. Kane | 27 | ST | 90 | 129500000.0 |
10 | N. Kanté | 30 | CDM, CM | 90 | 100000000.0 |
11 | K. Benzema | 33 | CF, ST | 89 | 66000000.0 |
12 | T. Courtois | 29 | GK | 89 | 85500000.0 |
13 | H. Son | 28 | LM, CF, LW | 89 | 104000000.0 |
6. Find out how many players of overall
rating greater than 90 exists in the dataset?
In [35]:
(df['overall'] > 90).sum()
Out[35]:
7
7. Find out how many players of value_eur
of less than or equal to 20000 in the dataset?
In [37]:
(df['value_eur'] <= 20_000).sum()
Out[37]:
10
8. Select the long_name
and age
of the players having the club_name='Manchester City'
and store your selection in the variable name long_name_age
In [46]:
long_name_age = df.loc[ df['club_name'] == 'Manchester City', ['long_name', 'age']];
In [ ]:
9. Filter out the players of Liverpool
club and who are from Brazil
and store them in the variable liverpool_brazil
Note: club_name
& nationality_name
are the column names
In [49]:
liverpool_brazil = df.loc[(df['club_name'] =="Liverpool") & (df['nationality_name'] == 'Brazil') ]
In [ ]:
10. How many players are there who have either mentality_aggression > 91
or power_stamina < 80
Note: Using query method will be easy
In [54]:
((df['mentality_aggression'] > 91) | (df['power_stamina'] < 80)).sum()
Out[54]:
16919
11. Select all players from France who have either mentality_aggression > 91
or power_stamina < 80
and store the filtered data in the variable france_player
In [57]:
france_player = df.loc[((df['mentality_aggression'] > 91) | (df['power_stamina'] < 80)) & (df['nationality_name'] == "France")]
In [58]:
france_player
Out[58]:
sofifa_id | player_url | short_name | long_name | player_positions | overall | potential | value_eur | wage_eur | age | ... | lcb | cb | rcb | rb | gk | player_face_url | club_logo_url | club_flag_url | nation_logo_url | nation_flag_url | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
10 | 215914 | https://sofifa.com/player/215914/ngolo-kante/2... | N. Kanté | N'Golo Kanté | CDM, CM | 90 | 90 | 100000000.0 | 230000.0 | 30 | ... | 84+3 | 84+3 | 84+3 | 85+3 | 20+3 | https://cdn.sofifa.net/players/215/914/22_120.png | https://cdn.sofifa.net/teams/5/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1335/60.png | https://cdn.sofifa.net/flags/fr.png |
11 | 165153 | https://sofifa.com/player/165153/karim-benzema... | K. Benzema | Karim Benzema | CF, ST | 89 | 89 | 66000000.0 | 350000.0 | 33 | ... | 55+3 | 55+3 | 55+3 | 59+3 | 18+3 | https://cdn.sofifa.net/players/165/153/22_120.png | https://cdn.sofifa.net/teams/243/60.png | https://cdn.sofifa.net/flags/es.png | https://cdn.sofifa.net/teams/1335/60.png | https://cdn.sofifa.net/flags/fr.png |
31 | 167948 | https://sofifa.com/player/167948/hugo-lloris/2... | H. Lloris | Hugo Lloris | GK | 87 | 87 | 13500000.0 | 125000.0 | 34 | ... | 30+3 | 30+3 | 30+3 | 34+3 | 85+2 | https://cdn.sofifa.net/players/167/948/22_120.png | https://cdn.sofifa.net/teams/18/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1335/60.png | https://cdn.sofifa.net/flags/fr.png |
37 | 195864 | https://sofifa.com/player/195864/paul-pogba/22... | P. Pogba | Paul Pogba | CM, LM | 87 | 87 | 79500000.0 | 220000.0 | 28 | ... | 72+3 | 72+3 | 72+3 | 72+3 | 13+3 | https://cdn.sofifa.net/players/195/864/22_120.png | https://cdn.sofifa.net/teams/11/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1335/60.png | https://cdn.sofifa.net/flags/fr.png |
57 | 201535 | https://sofifa.com/player/201535/raphael-varan... | R. Varane | Raphaël Varane | CB | 86 | 88 | 68500000.0 | 180000.0 | 28 | ... | 85+3 | 85+3 | 85+3 | 80+3 | 18+3 | https://cdn.sofifa.net/players/201/535/22_120.png | https://cdn.sofifa.net/teams/11/60.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/teams/1335/60.png | https://cdn.sofifa.net/flags/fr.png |
... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
18375 | 263276 | https://sofifa.com/player/263276/steven-goma/2... | S. Goma | Steven Goma | ST | 54 | 65 | 230000.0 | 750.0 | 19 | ... | 32+2 | 32+2 | 32+2 | 36+2 | 12+2 | https://cdn.sofifa.net/players/263/276/22_120.png | https://cdn.sofifa.net/teams/113391/60.png | https://cdn.sofifa.net/flags/ro.png | NaN | https://cdn.sofifa.net/flags/fr.png |
18381 | 263425 | https://sofifa.com/player/263425/adrien-delphi... | A. Delphis | Adrien Delphis | CM | 54 | 66 | 250000.0 | 500.0 | 18 | ... | 46+2 | 46+2 | 46+2 | 50+2 | 16+2 | https://cdn.sofifa.net/players/263/425/22_120.png | https://cdn.sofifa.net/teams/226/60.png | https://cdn.sofifa.net/flags/fr.png | NaN | https://cdn.sofifa.net/flags/fr.png |
18424 | 264501 | https://sofifa.com/player/264501/ilyes-hamache... | I. Hamache | Ilyes Hamache | RW | 54 | 69 | 250000.0 | 500.0 | 18 | ... | 27+2 | 27+2 | 27+2 | 34+2 | 10+2 | https://cdn.sofifa.net/players/264/501/22_120.png | https://cdn.sofifa.net/teams/110456/60.png | https://cdn.sofifa.net/flags/fr.png | NaN | https://cdn.sofifa.net/flags/fr.png |
18435 | 233645 | https://sofifa.com/player/233645/beni-nkololo/... | B. Nkololo | Béni Nkololo | CAM | 53 | 60 | 190000.0 | 500.0 | 24 | ... | 39+2 | 39+2 | 39+2 | 44+2 | 14+2 | https://cdn.sofifa.net/players/233/645/22_120.png | https://cdn.sofifa.net/teams/111396/60.png | https://cdn.sofifa.net/flags/au.png | NaN | https://cdn.sofifa.net/flags/fr.png |
18837 | 263712 | https://sofifa.com/player/263712/melvin-mastil... | M. Mastil | Melvin Mastil | GK | 52 | 62 | 160000.0 | 1000.0 | 21 | ... | 20+2 | 20+2 | 20+2 | 15+2 | 51+2 | https://cdn.sofifa.net/players/263/712/22_120.png | https://cdn.sofifa.net/teams/1862/60.png | https://cdn.sofifa.net/flags/ch.png | NaN | https://cdn.sofifa.net/flags/fr.png |
862 rows × 110 columns
12. Identify Left-Footed Players and Display Their Details
In [63]:
left_foot_players = df.loc[df['preferred_foot'] == 'Left', ['short_name', 'age', 'preferred_foot']]
In [64]:
left_foot_players
Out[64]:
short_name | age | preferred_foot | |
---|---|---|---|
0 | L. Messi | 34 | Left |
12 | T. Courtois | 29 | Left |
17 | M. Salah | 29 | Left |
18 | Ederson | 27 | Left |
25 | R. Lukaku | 28 | Left |
... | ... | ... | ... |
19198 | N. Rabha | 24 | Left |
19202 | J. Bradley-Walsh | 20 | Left |
19204 | Jiang Wenhao | 21 | Left |
19214 | R. Mahon | 18 | Left |
19219 | E. Kwelele | 19 | Left |
4565 rows × 3 columns
In [ ]: