Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

02-김윤지 #15

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -217,7 +217,7 @@
"[98 rows x 10 columns]"
]
},
"execution_count": 1,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
Expand Down Expand Up @@ -245,7 +245,7 @@
},
{
"cell_type": "code",
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -283,17 +283,30 @@
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Barcelona</td>\n",
" <td>LaLiga</td>\n",
" <td>85</td>\n",
" <td>15.3</td>\n",
" <td>68</td>\n",
" <th>0</th>\n",
" <td>Manchester City</td>\n",
" <td>Premier League</td>\n",
" <td>83</td>\n",
" <td>15.8</td>\n",
" <td>46</td>\n",
" <td>2</td>\n",
" <td>62.4</td>\n",
" <td>89.7</td>\n",
" <td>10.6</td>\n",
" <td>6.87</td>\n",
" <td>60.8</td>\n",
" <td>89.4</td>\n",
" <td>12.8</td>\n",
" <td>7.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Bayern Munich</td>\n",
" <td>Bundesliga</td>\n",
" <td>99</td>\n",
" <td>17.1</td>\n",
" <td>44</td>\n",
" <td>3</td>\n",
" <td>58.1</td>\n",
" <td>85.5</td>\n",
" <td>12.9</td>\n",
" <td>6.95</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
Expand All @@ -309,71 +322,59 @@
" <td>6.88</td>\n",
" </tr>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Manchester City</td>\n",
" <td>Premier League</td>\n",
" <td>83</td>\n",
" <td>15.8</td>\n",
" <td>46</td>\n",
" <th>3</th>\n",
" <td>Barcelona</td>\n",
" <td>LaLiga</td>\n",
" <td>85</td>\n",
" <td>15.3</td>\n",
" <td>68</td>\n",
" <td>2</td>\n",
" <td>60.8</td>\n",
" <td>89.4</td>\n",
" <td>12.8</td>\n",
" <td>7.01</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Juventus</td>\n",
" <td>Serie A</td>\n",
" <td>77</td>\n",
" <td>15.7</td>\n",
" <td>76</td>\n",
" <td>6</td>\n",
" <td>55.4</td>\n",
" <td>88.3</td>\n",
" <td>11.4</td>\n",
" <td>6.85</td>\n",
" <td>62.4</td>\n",
" <td>89.7</td>\n",
" <td>10.6</td>\n",
" <td>6.87</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>Sassuolo</td>\n",
" <td>Serie A</td>\n",
" <td>64</td>\n",
" <td>13.9</td>\n",
" <td>74</td>\n",
" <td>4</td>\n",
" <td>58.2</td>\n",
" <td>87.8</td>\n",
" <td>10.9</td>\n",
" <td>6.67</td>\n",
" <th>4</th>\n",
" <td>Real Madrid</td>\n",
" <td>LaLiga</td>\n",
" <td>67</td>\n",
" <td>14.4</td>\n",
" <td>57</td>\n",
" <td>2</td>\n",
" <td>57.7</td>\n",
" <td>87.7</td>\n",
" <td>11.8</td>\n",
" <td>6.86</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" Team Tournament Goals Shots pg yellow_cards \\\n",
"3 Barcelona LaLiga 85 15.3 68 \n",
"2 Paris Saint-Germain Ligue 1 86 15.0 73 \n",
"0 Manchester City Premier League 83 15.8 46 \n",
"6 Juventus Serie A 77 15.7 76 \n",
"35 Sassuolo Serie A 64 13.9 74 \n",
" Team Tournament Goals Shots pg yellow_cards \\\n",
"0 Manchester City Premier League 83 15.8 46 \n",
"1 Bayern Munich Bundesliga 99 17.1 44 \n",
"2 Paris Saint-Germain Ligue 1 86 15.0 73 \n",
"3 Barcelona LaLiga 85 15.3 68 \n",
"4 Real Madrid LaLiga 67 14.4 57 \n",
"\n",
" red_cards Possession% Pass% AerialsWon Rating \n",
"3 2 62.4 89.7 10.6 6.87 \n",
"2 7 60.1 89.5 9.5 6.88 \n",
"0 2 60.8 89.4 12.8 7.01 \n",
"6 6 55.4 88.3 11.4 6.85 \n",
"35 4 58.2 87.8 10.9 6.67 "
" red_cards Possession% Pass% AerialsWon Rating \n",
"0 2 60.8 89.4 12.8 7.01 \n",
"1 3 58.1 85.5 12.9 6.95 \n",
"2 7 60.1 89.5 9.5 6.88 \n",
"3 2 62.4 89.7 10.6 6.87 \n",
"4 2 57.7 87.7 11.8 6.86 "
]
},
"execution_count": 4,
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df.sort_values(by='Pass%', ascending=False).head(5)"
"df.sort_values(by=\"Pass%\", ascending=False)\n",
"df.head()"
]
},
{
Expand All @@ -386,7 +387,7 @@
},
{
"cell_type": "code",
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -478,13 +479,13 @@
"3 2 62.4 89.7 10.6 6.87 "
]
},
"execution_count": 5,
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df[df['Possession%']>=60]"
"df[df[\"Possession%\"]>60]"
]
},
{
Expand All @@ -498,7 +499,7 @@
},
{
"cell_type": "code",
"execution_count": 22,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -571,15 +572,15 @@
"Bundesliga 1081 33"
]
},
"execution_count": 22,
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df1 = df.loc[:, ['Tournament', 'yellow_cards', 'red_cards']]\n",
"df2 = df1.groupby('Tournament').sum()\n",
"df2.sort_values(['yellow_cards', 'red_cards'], ascending=[False, False])"
"df2=df.groupby(df['Tournament']).sum().sort_values(['yellow_cards','red_cards'],ascending= False)\n",
"df2=df2.loc[:,['yellow_cards','red_cards']]\n",
"df2"
]
},
{
Expand All @@ -597,7 +598,7 @@
},
{
"cell_type": "code",
"execution_count": 25,
"execution_count": 6,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -677,14 +678,14 @@
"Bundesliga 1081 33 2327"
]
},
"execution_count": 25,
"execution_count": 6,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"df2['score'] = df2['red_cards']*5 + df2['yellow_cards']*2\n",
"df2.sort_values('score', ascending=False)"
"df2['score']=df2['red_cards']*5 +df2['yellow_cards']*2\n",
"df2"
]
},
{
Expand All @@ -699,7 +700,7 @@
},
{
"cell_type": "code",
"execution_count": 31,
"execution_count": 41,
"metadata": {},
"outputs": [
{
Expand All @@ -709,15 +710,12 @@
" [19.52841995, 21.99771618]])"
]
},
"execution_count": 31,
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"arr = df.loc[:, ['Possession%', 'Pass%']].to_numpy()\n",
"np.cov(arr.T)"
]
"source": []
},
{
"cell_type": "code",
Expand All @@ -743,7 +741,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.5"
"version": "3.8.8"
}
},
"nbformat": 4,
Expand Down
Loading