๋ฌ๋์คํผ์ฆ ์์ ์ ๋ฆฌ
< ์ด์ ๊ธ >
https://silvercoding.tistory.com/69
[๋จธ์ ๋ฌ๋] ๋ณ์์ค์๋, shap value
๋ฌ๋์คํผ์ฆ ์์ ์ ๋ฆฌ < ์ด์ ๊ธ > https://silvercoding.tistory.com/67 https://silvercoding.tistory.com/66 https://silvercoding.tistory.com/65 https://silvercoding.tistory.com/64 https://silvercoding...
silvercoding.tistory.com
Menchester United ํ์์ 2013๋ Alex Ferguson ๊ฐ๋ ์ด ์ํด๋ฅผ ํ๊ณ , ํ๋ฝ์ธ๋ฅผ ํ๋ค๊ฐ ์์ค๋ฅด ๊ฐ๋ ์ด ํ์ ๋งก๊ฒ๋์์ ๋ 2020๋ 3์ ๊ธฐ์ค 2019/2020 ์์ฆ ๊ฒจ์ธ ์์ฅ์์ ๋๋ช ์ ์ ์๋ฅผ ์์ ํ์ฌ ํ๋ฝ์ธ๋ฅผ ๋ฐ์ ์ํฌ ์ ์์๋ค.
์ด๋ฅผ ์ ์๋ค์ ๋ฐ์ดํฐ ๋ถ์์ ํตํด ๋ฐฉ์ถ๊ณผ ์์ ์ ๊ฒฐ์ ํ๋ค๋ฉด, ์ด๋ค ๊ฒฐ๊ณผ๊ฐ ๋์ฌ๊น?
๋ฐ์ดํฐ : FIFA ๋ฐ์ดํฐ (๋ฌ๋์คํผ์ฆ ๊ฐ์ ์ ๊ณต)
1. ๋ฐ์ดํฐ ๋ถ๋ฌ์ค๊ธฐ
import pandas as pd
import warnings
warnings.filterwarnings(action='ignore') # ๊ฒฝ๊ณ ๋ฌธ ์ ๊ฑฐ
data = pd.read_csv("./data/FIFA_data.csv")
pd.set_option('display.max_columns', 80)
column์ด ๋ง์ผ๋ฉด ... ์ผ๋ก ์๋ต๋์ด์๊ธฐ ๋๋ฌธ์ ๋ฐ์ดํฐ์ ์ปฌ๋ผ ์์ธ 80๊ฐ๋ก ์ค์ ํด์ค๋ค.
data.head()
๋ชจ๋ ์ปฌ๋ผ์ ํ์ธํด๋ณผ ์ ์๋ค.
2. ๋ฐ์ดํฐ ํ์ธ, ๋ถ์๊ณํ
์ปฌ๋ผ ๋ณ ์๋ฏธ ํ์ธ
ID | ๊ณ ์ ์ ๋ฒํธ |
Name | ์ด๋ฆ |
Age | ๋์ด |
Overall | ํ์ฌ ๋ฅ๋ ฅ์น |
Potential | ์ ์ฌ ๋ฅ๋ ฅ์น |
Club | ์์ ํ |
Value | ์์ ์ด์ ๋ฃ (์ ๋ก) |
Wage | ์ฃผ๊ธ (์ ๋ก) |
Preferred Foot | ์ ์ฌ์ฉํ๋ ๋ฐ |
Weak Foot | ์ ์ฌ์ฉํ์ง ์๋ ๋ฐ |
Skill Moves | ๊ฐ์ธ๊ธฐ |
Position | ํฌ์ง์ |
Jersey Number | ๋ฑ๋ฒํธ |
Joined | ์์ ํ ์ ๋จ ๋ ์ง |
Contract Valid Until | ๊ณ์ฝ ๊ธฐ๊ฐ |
Height | ํค (ํผํธ) |
Weight | ๋ชธ๋ฌด๊ฒ (ํ์ด๋) |
LS ~ RB | ํฌ์ง์ ๋ณ ๋ฅ๋ ฅ์น |
Crossing ~ GKReflexes | ์ธ๋ถ ๋ฅ๋ ฅ์น |
Release Clause | ๋ฐ์ด์์ |
๋ถ์ ์ ์ฐจ ์๋ฆฝ
1. Manchester United ์ ์ ๋ถ์ (์ด๋ค ์ ์๋ค์ด ์กด์ฌํ๋๊ฐ?)
2. Manchester United ์ง์ญ๋ผ์ด๋ฒ Manchester City ์ ์๋ค๊ณผ ๋น๊ต ๋ถ์
3. ๋ถ์กฑํ ํฌ์ง์ 2๊ฐ์ง ์ ํ
4. ๋ค๋ฅธํ์ ์ ์๋ค ์ค 2๋ช ์ ์์ ์ ์ ์ ํ (์ฌ์ , ํ์ค๊ฐ๋ฅ์ฑ, ์์ ๋ฐฉ์นจ ๊ณ ๋ ค)
3. Manchester United ์ ์๋ค ๋ถ์
(1) EDA
- ๋งจ์ ์ ์ ์ถ์ถ
mu = data[data['Club'] == 'Manchester United']
mu.head()
Club์ด Manchester United์ธ ํ๋ง ๋ฝ์ mu์ ์ ์ฅํด์ค๋ค.
mu['Club'].unique()
unique() ํจ์๋ฅผ ์ฌ์ฉํ์ฌ ํ์ธํด ๋ณด๋ ๋งจ์ ๋ง ์ ๋ฝํ ๊ฒ์ ๋ณผ ์ ์๋ค.
- ๋งจ์ ์ ์๋ค ๊ฐ๋ตํ ์ ๋ณด ์ถ๋ ฅ
print(f"์ธ์: {mu.shape[0]}")
print(f"๋งจ์ ์ ์๋ค์ ํฌ์ง์
: {mu['Position'].unique()}")
print(f"ํ๊ท ๋ฅ๋ ฅ์น: {mu['Overall'].mean()}")
print(f"ํ๊ท ์ ์ฌ ๋ฅ๋ ฅ์น: {mu['Potential'].mean()}")
- ์๊ฐํ
import seaborn as sns
sns.countplot(mu['Age'])
์ ์๋ค์ ๋์ด ๋ถํฌ์ด๋ค. 19์ด์ด ๊ฐ์ฅ ๋ง๊ณ , ๊ทธ๋ค์์ผ๋ก 25์ด, 28์ด, 22์ด์ธ ๊ฒ์ ์ ์ ์๋ค.
sns.countplot(mu['Position'])
ใ
์ ์๋ค์ ํฌ์ง์ ์ค ๊ฐ์ฅ ๋ง์ ๊ฒ์ CM, CB ์ด๋ค.
sns.boxplot(data=mu, x='Position', y='Overall')
Position๋ณ ๋ฅ๋ ฅ์น boxplot ์ ๊ทธ๋ ค๋ณด์๋๋ CB ํฌ์ง์ ์์ ์ด์์น๊ฐ ๋ฐ๊ฒฌ๋์๋ค.
* ์ด์์น & ๊ฒฐ์ธก์น ์ฒ๋ฆฌ
์ด์์น
- ์ ์ ๋ฒ์ฃผ์์ ํฌ๊ฒ ๋ฒ์ด๋ ๊ฐ
- ์ด์์น๋ฅผ ํฌํจํ์ฌ ๋ถ์์ ์งํํ ๊ฒฝ์ฐ ๋ถ์ ๊ฒฐ๊ณผ๊ฐ ์๊ณก๋ ๊ฐ๋ฅ์ฑ์ด ์์
๊ฒฐ์ธก์น
- ๋๋ฝ๊ฐ, ๋น์ด์๋ ๊ฐ
- ๋ฐ์ดํฐ ์์ง ๋น์ ๊ธฐ๋ก๋์ง ์์๊ฑฐ๋, ๋๋ฝ๋ ๊ฐ
์ด์์น์ ๊ฒฐ์ธก์น ์ฒ๋ฆฌ๋ฒ
- ์ ๊ฑฐ: ์ด์์น ๋ฐ ๊ฒฐ์ธก์น๊ฐ ํฌํจ๋์ด ์๋ ํ, ํน์ ์ด์ ์ ๊ฑฐํ๋ค. (์ตํ์ ์๋จ, ๋ฐ์ดํฐ ํ๋ํ๋๊ฐ ์์คํ๊ธฐ ๋๋ฌธ)
- ๋์ฒด: ์ด์์น ๋ฐ ๊ฒฐ์ธก์น๋ฅผ ํด๋น ์ปฌ๋ผ์ ์ต๋๊ฐ, ํ๊ท ๊ฐ, ์ค์๊ฐ ๋ฑ์ผ๋ก ๋์ฒด (์ถ์ฒํ๋ ๋ฐฉ๋ฒ์ ์๋.)
- ์์ธก: ์ด์์น ๋ฐ ๊ฒฐ์ธก์น๊ฐ ํฌํจ๋ ์ปฌ๋ผ์ ํน์ฑ์ ๊ณ ๋ คํ์ฌ ์์ธก ๊ฐ์ผ๋ก ์ฑ์ ๋ฃ์ (์ถ์ฒ)
mu[mu['Overall']>100]
๋ฅ๋ ฅ์น๊ฐ 100์ด์์ธ row๋ฅผ ํ์ธํด ๋ณธ๋ค.
์ด์์น ์ฒ๋ฆฌ - ์์ธก ์ฌ์ฉ
mu[mu['Position'] == 'CB'][['Position', 'Overall', 'CB']]
๊ฐ์ ํฌ์ง์ ์ ์๋ค๋ผ๋ฆฌ ๋น๊ต๋ฅผ ํด๋ณธ๋ค. CB๊ฐ ๋น์ทํ ์ ์๋ค๋ผ๋ฆฌ์ ๋ฅ๋ ฅ์น๊ฐ ๊ฐ์ ๊ฒ์ ์ ์ ์๋ค. ์ด์์น๋ฅผ ๊ฐ๊ณ ์๋ ์ ์๋ 11081 ๋ฒ์งธ ์ ์์ CB๊ฐ ๊ฐ์ผ๋ฏ๋ก 75๋ก ์์ธกํ ์ ์๋ค.
mu['Overall'][11422] = 75
11422 ๋ฒ์งธ ์ ์์ ๋ฅ๋ ฅ์น๋ฅผ 75๋ก ๋ฐ๊พธ์ด์ค๋ค.
sns.boxplot(data=mu, x='Position', y='Overall')
๋ค์ boxplot์ ๊ทธ๋ ค๋ณด๋ ์ด์์น ์์ด ๊ทธ๋ ค์ง ๊ฒ์ ๋ณผ ์ ์๋ค.
sns.boxplot(data=mu, x='Position', y='Potential')
potential์ ๋ํ boxplot๋ ๊ทธ๋ ค์ค๋ค. potential์๋ ์ด์์น๊ฐ ๋์ค์ง ์์๋ค.
mu.info()
mu๋ ์ด 33๊ฐ์ row์ธ๋ฐ, 19~44 ๋ฒ์งธ ์ปฌ๋ผ์ 3๊ฐ์ ๊ฒฐ์ธก๊ฐ์ด ์๋ ๊ฒ์ด ํ์ธ๋์๋ค.
mu[mu.isnull()['LS']]
ํฌ์ง์ ์ด GK์ธ ์ ์๋ค๋ง ๊ฒฐ์ธก๊ฐ์ด ์๋ ๊ฒ์ผ๋ก ๋ณด์ธ๋ค. GK๋ ๊ณจํคํผ์ด๊ณ , ๊ณจํคํผ๋ ๋ค๋ฅธ ํฌ์ง์ ์ ๋ํ ๋ฅ๋ ฅ์น๋ฅผ ๋ถ์ฌํ ํ์๊ฐ ์๊ธฐ ๋๋ฌธ์ ๊ฒฐ์ธก๊ฐ์ผ๋ก ๋ ๊ฒ์ผ๋ก ์์ํ ์ ์๋ค.
mu = mu.fillna(-1)
๊ฒฐ์ธก๊ฐ์ -1๋ก ์ฑ์์ค๋ค. (๊ฐ์ ์ธก์ ํ ์ ์๋ค๋ ์๋ฏธ์์ ์์์ ๊ฐ -1, ๋ค๋ฅธ๊ฐ์ ๋ฃ์ด์ฃผ์ด๋ ๋จ)
mu.info()
๊ฒฐ์ธก๊ฐ์ด ๋ชจ๋ ์ฑ์์ก๋ค.
4. Manchester United vs Manchester City
(1) ์ ์ฒ๋ฆฌ
df = data[(data['Club'] == 'Manchester United') | (data['Club']=='Manchester City')]
Manchester United์ Manchester City๋ง ๋ฝ์ df ์ ์ ์ฅํด์ค๋ค.
df['Club'].unique()
df['Value'].head()
์ด์ ๋ฃ Value๊ฐ ๊ธฐํธ๋ก ์จ์ ธ์์ผ๋ฏ๋ก, ๊ธฐํธ ์ญ์ , ์์์ ์ญ์ ๋ฅผ ์งํํ๋ค.
df['Value'] = df['Value'].str.replace('M', '000000')
df['Value'] = df['Value'].str.replace('K', '000')
M์ด ์จ์ ธ์์ผ๋ฉด 0์ 6๊ฐ, K๊ฐ ์จ์ ธ์์ผ๋ฉด 0์ 3๊ฐ ๋ถ์ฌ ์ค๋ค.
df['Value']
df['Value'] = df['Value'].str.slice(1,)
๊ทธ๋ค์ str.slice๋ฅผ ์ด์ฉํ์ฌ ๊ธฐํธ๋ฅผ ์์ ์ค๋ค.
df['Value'].iloc[3]
'64.5000000'
์ด๋ ๊ฒ ์์์ ์ด ์๋ ๊ฒ์ด ์กด์ฌํ๋ฏ๋ก, ์ ์ ์์ ๊ณ ๋ค์ 0์ ํ๋ ์ญ์ ํ๋ค.
for i in df["Value"]:
if '.' in i:
df['Value'] = df['Value'].str.replace('.', '')
df['Value'] = df['Value'].str.slice(0,-1)
df['Value']
์ ์ฉ์ด ์ ๋ ๊ฒ์ ๋ณผ ์ ์๋ค.
df['Value'] = df['Value'].astype('int')
์ด์ ๋ฐ์ดํฐ ํ์ ์ object -> int๋ก ๋ฐ๊ฟ์ค๋ค.
df.head()
- mu, mc ์ ์ ๋ถ๋ฆฌ
mu = df[df['Club'] == "Manchester United"]
mc = df[df['Club'] == "Manchester City"]
df์์ Manchester United, Manchester City ์ ์๋ค์ ๋ถ๋ฆฌํด ์ค๋ค.
mc.head()
df['Position'].unique()
์์ ํฌ์ง์ ์ ๊ณจ๊ธฐํผ, ์๋น์, ๋ฏธ๋ํ๋, ๊ณต๊ฒฉ์, ์ด 4๊ฐ์ง๋ก ๋ถ๋ฅํ์ฌ ๋ถ์์ ์งํํ๋ค. ํฌ์ง์ ์ ๋๋๋ฉด ๋ค์๊ณผ ๊ฐ๋ค.
- ๊ณจํคํผ ๋ฆฌ์คํธ GK= GK (๊ณจํคํผ)
- ์๋น์ ๋ฆฌ์คํธ CB = CB(์ค์ ์๋น์), LB(์ผ์ชฝ ์๋น์), RB(์ค๋ฅธ์ชฝ ์๋น์), RCB(์ค๋ฅธ์ชฝ/์ค์ ์๋น์), LCB(์ผ์ชฝ/์ค์ ์๋น์)
- ๋ฏธ๋ํ๋ ๋ฆฌ์คํธ MF = RCM(์ค๋ฅธ์ชฝ/์ค์ ๋ฏธ๋ํ๋), LCM(์ผ์ชฝ/์ค์ ๋ฏธ๋ํ๋), RDM(์ค๋ฅธ์ชฝ ์๋นํ ๋ฏธ๋ํ๋), CDM(์ค์ ์๋นํ ๋ฏธ๋ํ๋), CM(์ค์ ๋ฏธ๋ํ๋), RM(์ค๋ฅธ์ชฝ ๋ฏธ๋ํ๋), CAM(์ค์ ๊ณต๊ฒฉํ ๋ฏธ๋ํ๋)
- ๊ณต๊ฒฉ์ ๋ฆฌ์คํธ ST = ST(์ ๋ฐฉ ๊ณต๊ฒฉ์), LW(์ผ์ชฝ ๊ณต๊ฒฉ์), RW(์ค๋ฅธ์ชฝ ๊ณต๊ฒฉ์)
* GK(๊ณต๊ฒฉ์) : 1๋ช , CB(์๋น์) : 4๋ช , MF(๋ฏธ๋ํ๋) : 4๋ช , ST(๊ณต๊ฒฉ์) : 2๋ช ์ ๋ฐ
-> ์ ๋ฐ์ ๊ธฐ์ค์ ํ์ฌ๋ฅ๋ ฅ์น(Overall ์ปฌ๋ผ)
gk_list = ['GK']
cb_list = ['CB', 'LCB', 'RCB', 'RB', 'LB']
mf_list = ['RCM', 'LCM', 'RDM', 'CDM', 'CM', 'RM', 'CAM']
st_list = ['ST', 'LW', 'RW']
ํฌ์ง์ ์ ๋ถ๋ฅํ๋๋ก ๋ฆฌ์คํธ๋ฅผ ์์ฑํด์ค๋ค.
gk_count = 1
cb_count = 4
mf_count = 4
st_count = 2
mu_id = []
for index in mu.index:
if mu['Position'][index] in gk_list:
if gk_count != 0:
mu_id.append(mu['ID'][index])
gk_count -= 1
elif mu['Position'][index] in cb_list:
if cb_count != 0:
mu['Position'][index] = 'CB'
mu_id.append(mu['ID'][index])
cb_count -= 1
elif mu['Position'][index] in mf_list:
if mf_count != 0:
mu['Position'][index] = 'MF'
mu_id.append(mu['ID'][index])
mf_count -= 1
else:
if st_count != 0:
mu['Position'][index] = 'ST'
mu_id.append(mu['ID'][index])
st_count -= 1
ํ์ฌ๋ฅ๋ ฅ์น๊ฐ ๋์ ์์ผ๋ก ์ ๋ ฌ๋์ด์๋ ๋ฐ์ดํฐ์ด๊ธฐ ๋๋ฌธ์ ์์๋๋ก ์์ ํฌ์ง์ ์ ์๋ค์ ID ๊ฐ์ ๋ฆฌ์คํธ์ ๋ฃ์ด์ค๋ค.
mu[mu['ID'].isin(mu_id)]
11๋ช ์ ์ ์๊ฐ ์๋ง๊ฒ ๋์จ ๊ฒ์ ๋ณผ ์ ์๋ค.
mu = mu[mu['ID'].isin(mu_id)]
์ ๋ฐ๋ 11๋ช ์ ์ ์๋ค๋ง mu ๋ณ์์ ๋ฃ์ด ์ค๋ค.
๊ฐ์ ์ ์ฐจ๋ก Manchester City ๋ํ ์งํํ๋ค.
gk_count = 1
cb_count = 4
mf_count = 4
st_count = 2
mc_id = []
for index in mc.index:
if mc['Position'][index] in gk_list:
if gk_count != 0:
mc_id.append(mc['ID'][index])
gk_count -= 1
elif mc['Position'][index] in cb_list:
if cb_count != 0:
mc['Position'][index] = 'CB'
mc_id.append(mc['ID'][index])
cb_count -= 1
elif mc['Position'][index] in mf_list:
if mf_count != 0:
mc['Position'][index] = 'MF'
mc_id.append(mc['ID'][index])
mf_count -= 1
else:
if st_count != 0:
mc['Position'][index] = 'ST'
mc_id.append(mc['ID'][index])
st_count -= 1
mc = mc[mc['ID'].isin(mc_id)]
concat vs merge
merge: ์ข์ฐํฉ๋ณ, concat: ์ํํฉ๋ณ
df = pd.concat([mu, mc])
์ ๋ฐ๋ mu, mc ์ ์๋ค์ ํฉ์ณ df์ ์ ์ฅํด์ค๋ค.
(2) EDA
- mu vs mc ํฌ์ง์ ๋ณ ์ฃผ์ ์ ์์ ํ์ฌ๋ฅ๋ ฅ์น(overall) ๋น๊ต
df = pd.concat([mu, mc])
๊ณจ๊ธฐํผ๋ฅผ ๋บ ํ ํฌ์ง์ ์ ๋ชจ๋ Manchester United ํ์ด ๋ฎ์ ๊ฒ์ ๋ณผ ์ ์๋ค.
- mu vs mc ํฌ์ง์ ๋ณ ์ฃผ์ ์ ์์ ์์์ด์ ๋ฃ(Value) ๋น๊ต
sns.boxplot(data=df, x='Position', y='Value', hue='Club')
์ด์ ๋ฃ๋ ๊ณจ๊ธฐํผ๋ฅผ ๋นผ๊ณ ๊ฑฐ์ ์ฐจ์ด๊ฐ ์๊ฑฐ๋ ๋ ๋์ ๊ฒ์ ๋ณผ ์ ์๋ค.
์์ boxplot์ผ๋ก ๋ ํ์ ๋น๊ตํด๋ณด์์ ๋, ์ด์ ๋ฃ ๋๋น ๋ฅ๋ ฅ์น๊ฐ ๋จ์ด์ง๋ ํฌ์ง์ ์ MF, CB๋ก ํ๋จํ์ฌ ๋ ํฌ์ง์ ์ ๋ํด ์ด๋ค ์ ์๋ฅผ ์์ ํ ์ง ๋ถ์์ ํด๋ณธ๋ค.
5. Manchester United๋ ์ด๋ค ์ ์๋ฅผ ์์ ํด์ผ ํ๋๊ฐ?
(1) EDA
* ๋ฐฉ์ถ ์ ์ ์ ์
์์ ์ผ, ๋ฅ๋ ฅ์น, ์ ์ฌ๋ ฅ, ๋์ด๋ฅผ ๊ธฐ์ค์ผ๋ก ๊ณต์ ์ธ์ฐ๊ธฐ
Point = (Overall * 2 + Potential) / Age
๋ฅ๋ ฅ์น(๊ฐ์ค์น๋ฅผ ๊ฐํจ)์ ์ ์ฌ๋ ฅ์ด ๋์ ์๋ก, ๋์ด๊ฐ ๋ฎ์ ์๋ก ์ข์.
mu['Point'] = (mu['Overall'] * 2 + mu['Potential']) / mu['Age']
- MF ํฌ์ง์
mu[mu['Position'] == 'MF'][['Name', 'Overall', 'Potential', 'Age', 'Joined', 'Point']]
๊ฐ์ฅ ๋ฎ์ ํฌ์ธํธ๋ 211๋ฒ ์ ์์ด๋ค.
- CB ํฌ์ง์
mu[mu['Position'] == 'CB'][['Name', 'Overall', 'Potential', 'Age', 'Joined', 'Point']]
๊ฐ์ฅ ๋ฎ์ ํฌ์ธํธ๋ 377๋ฒ ์ ์์ด๋ค.
๋งํ, ์ค๋ชฐ๋ง ๋ ์ ์๋ฅผ ๋ฐฉ์ถํ๊ณ MF, CB ํฌ์ง์ ์ ํ๋ช ์ฉ ์์ ํ๋ค.
(2) ์๊ฐํ
์ ์ฒด ์ ์ ์๊ฐํ - ์์ ๋ฐฉ์นจ์ ๋ฐ๋ฅธ ์์ ์ ์ ๊ฒฐ์
Manchester United ์์ ๋ฐฉ์นจ (์์ค๋ฅด๊ฐ๋ )
- ์ ์์ ๋์ด๋ ์ด๋ฆด ์๋ก ์ข์
- ์ ์ฌ๋ ฅ ๋ณด๋ค ํ์ฌ ๋ฐ๋ก ์ฃผ์ ์ผ๋ก ๋ธ ์ ์๋ ์ ์
market = data[(data['Position']=='RM') | (data['Position']=='CB')]
ํฌ์ง์ ์ ๋ฐฉ์ถ ์ ์ ๋ ๋์ ์์ ์ธ๋ถ ํฌ์ง์ ์ธ RM, CB๋ฅผ ์ ํํ๋ค.
market.head()
import matplotlib.pyplot as plt
f, ax = plt.subplots(2, 4, figsize=(20, 10))
vs_list = ['Age', 'Overall', 'Potential', 'Weak Foot']
for i in range(8):
if i < 4:
colors = ['firebrick' if x > market[market['Position']=='CB'][:13][vs_list[i]].mean() else 'gray' for x in market[market['Position']=='CB'][:13][vs_list[i]]]
sns.barplot(x=vs_list[i], y='Name', data=market[market['Position']=='CB'][:13], ax=ax[i//4, i%4], palette=colors)
ax[i//4, i%4].axvline(market[market['Position']=='CB'][:13][vs_list[i]].mean(), ls = '--', color='k')
else:
colors = ['firebrick' if x > market[market['Position']=='RM'][:13][vs_list[i%4]].mean() else 'gray' for x in market[market['Position']=='RM'][:13][vs_list[i%4]]]
sns.barplot(x=vs_list[i%4], y='Name', data=market[market['Position']=='RM'][:13], ax=ax[i//4, i%4], palette=colors)
ax[i//4, i%4].axvline(market[market['Position']=='RM'][:13][vs_list[i%4]].mean(), ls='--', color='k')
๋ฐ์ดํฐ ๋ถ์์ผ๋ก ๋ค๋ฅธ ๊ฒ์ ๋ฐฐ์ ํ๊ณ ๋์ด, ํ์ฌ ๋ฅ๋ ฅ์น, ์ ์ฌ๋ ฅ์ผ๋ก๋ง ๋ฐ์ง๋ค๊ณ ํ์ ๋, ์์ ๋ฐฉ์นจ์ ๋ฐ๋ผ ์์ ์ ๊ฒฐ์ ํ๋ค๋ฉด S. Umtiti, K. Mbappé ์ ์๊ฐ ๋ ๊ฒ์ด๋ผ ํ๋จํ์๋ค.