Skip to content

Commit

Permalink
refactor : filename
Browse files Browse the repository at this point in the history
  • Loading branch information
mathisdrn committed Apr 7, 2024
1 parent 85ccb42 commit 7d8f3da
Show file tree
Hide file tree
Showing 8 changed files with 159 additions and 35 deletions.
14 changes: 7 additions & 7 deletions _toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@
format: jb-book
root: Paper.md
chapters:
- file: ./src/02 - Data extraction
- file: ./src/03 - Preprocessing
- file: ./src/04 - Headcoach analysis
- file: ./src/05 - Match results analysis
- file: ./src/06 - Extending EDA
- file: ./src/07 - More preprocessing
- file: ./src/08 - Statistical analysis
- file: ./src/00 Data extraction
- file: ./src/01 Preprocessing
- file: ./src/02 Headcoach analysis
- file: ./src/03 Match results analysis
- file: ./src/04 Statistical analysis
# - file: ./src/06 - Extending EDA
# - file: ./src/07 - More preprocessing
180 changes: 152 additions & 28 deletions src/02 - Data extraction.ipynb → src/00 Data extraction.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "markdown",
"id": "0",
"id": "7a2d36dd",
"metadata": {},
"source": [
"---\n",
Expand All @@ -13,14 +13,25 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "1",
"execution_count": 2,
"id": "b07eaee9",
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"Le chargement a n'ecessit'e le package : worldfootballR\n",
"\n",
"Le chargement a n'ecessit'e le package : data.table\n",
"\n"
]
}
],
"source": [
"if (!require(worldfootballR)) { \n",
" install.packages(\"worldfootballR\")\n",
Expand All @@ -36,7 +47,7 @@
},
{
"cell_type": "markdown",
"id": "2",
"id": "19a44114",
"metadata": {
"vscode": {
"languageId": "r"
Expand All @@ -48,8 +59,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "3",
"execution_count": 2,
"id": "db3124e1",
"metadata": {
"vscode": {
"languageId": "r"
Expand All @@ -64,8 +75,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "4",
"execution_count": 3,
"id": "aded1103",
"metadata": {
"vscode": {
"languageId": "r"
Expand All @@ -86,7 +97,7 @@
},
{
"cell_type": "markdown",
"id": "5",
"id": "1177370e",
"metadata": {},
"source": [
"Nous avons récupéré les données pour les ligues suivante : {eval}`paste(unique(result$league), collapse = \", \")`. Cela concerne {eval}`nrow(result)` matchs pour la période {eval}`min(year)` à {eval}`max(year)`. "
Expand All @@ -95,7 +106,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "6",
"id": "f1862f2c",
"metadata": {
"vscode": {
"languageId": "r"
Expand All @@ -109,7 +120,7 @@
{
"cell_type": "code",
"execution_count": null,
"id": "7",
"id": "dbe1319d",
"metadata": {
"vscode": {
"languageId": "r"
Expand All @@ -123,22 +134,34 @@
},
{
"cell_type": "markdown",
"id": "8",
"id": "0dd1d968",
"metadata": {},
"source": [
"### Les données sur les entraîneurs-chefs"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9",
"execution_count": 3,
"id": "28e076f6",
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1] \"England : 20 teams\"\n",
"[1] \"Spain : 20 teams\"\n",
"[1] \"Italy : 20 teams\"\n",
"[1] \"Germany : 18 teams\"\n",
"[1] \"France : 20 teams\"\n"
]
}
],
"source": [
"country <- c(\"England\", \"Spain\", \"Italy\", \"Germany\", \"France\")\n",
"\n",
Expand All @@ -153,29 +176,111 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "10",
"execution_count": 4,
"id": "d8ce18f9",
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"[1] \"4855 head coaches records\"\n"
]
}
],
"source": [
"head_coach <- tm_team_staff_history(team_urls = teams_url, staff_role = \"Manager\")\n",
"print(paste(nrow(head_coach), \"head coaches records\"))"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "11",
"execution_count": 5,
"id": "3bd70b01",
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"<style>\n",
".list-inline {list-style: none; margin:0; padding: 0}\n",
".list-inline>li {display: inline-block}\n",
".list-inline>li:not(:last-child)::after {content: \"\\00b7\"; padding: 0 .5ex}\n",
"</style>\n",
"<ol class=list-inline><li>'Premier League'</li><li>'Championship'</li><li>'LaLiga'</li><li>'LaLiga2'</li><li>'Serie A'</li><li>'Serie B'</li><li>'Serie C - Girone B'</li><li>NA</li><li>'Bundesliga'</li><li>'2. Bundesliga'</li><li>'Ligue 1'</li><li>'Ligue 2'</li><li>'Championnat National'</li></ol>\n"
],
"text/latex": [
"\\begin{enumerate*}\n",
"\\item 'Premier League'\n",
"\\item 'Championship'\n",
"\\item 'LaLiga'\n",
"\\item 'LaLiga2'\n",
"\\item 'Serie A'\n",
"\\item 'Serie B'\n",
"\\item 'Serie C - Girone B'\n",
"\\item NA\n",
"\\item 'Bundesliga'\n",
"\\item '2. Bundesliga'\n",
"\\item 'Ligue 1'\n",
"\\item 'Ligue 2'\n",
"\\item 'Championnat National'\n",
"\\end{enumerate*}\n"
],
"text/markdown": [
"1. 'Premier League'\n",
"2. 'Championship'\n",
"3. 'LaLiga'\n",
"4. 'LaLiga2'\n",
"5. 'Serie A'\n",
"6. 'Serie B'\n",
"7. 'Serie C - Girone B'\n",
"8. NA\n",
"9. 'Bundesliga'\n",
"10. '2. Bundesliga'\n",
"11. 'Ligue 1'\n",
"12. 'Ligue 2'\n",
"13. 'Championnat National'\n",
"\n",
"\n"
],
"text/plain": [
" [1] \"Premier League\" \"Championship\" \"LaLiga\" \n",
" [4] \"LaLiga2\" \"Serie A\" \"Serie B\" \n",
" [7] \"Serie C - Girone B\" NA \"Bundesliga\" \n",
"[10] \"2. Bundesliga\" \"Ligue 1\" \"Ligue 2\" \n",
"[13] \"Championnat National\""
]
},
"metadata": {},
"output_type": "display_data"
},
{
"data": {
"text/html": [
"'3528 head coaches records for leagues of interests'"
],
"text/latex": [
"'3528 head coaches records for leagues of interests'"
],
"text/markdown": [
"'3528 head coaches records for leagues of interests'"
],
"text/plain": [
"[1] \"3528 head coaches records for leagues of interests\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# match_results$league : 'Premier League''La Liga''Ligue 1''Bundesliga''Serie A'\n",
"unique(head_coach$league)\n",
Expand All @@ -186,7 +291,7 @@
},
{
"cell_type": "markdown",
"id": "12",
"id": "b261f69c",
"metadata": {},
"source": [
"Leagues in which we are collecting data : {eval}`unique(head_coach$league)`\n",
Expand All @@ -196,14 +301,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "13",
"execution_count": 6,
"id": "a0a244ab",
"metadata": {
"vscode": {
"languageId": "r"
}
},
"outputs": [],
"outputs": [
{
"data": {
"text/html": [
"'298 head coaches records for leagues of interests active between 2018 and 2022'"
],
"text/latex": [
"'298 head coaches records for leagues of interests active between 2018 and 2022'"
],
"text/markdown": [
"'298 head coaches records for leagues of interests active between 2018 and 2022'"
],
"text/plain": [
"[1] \"298 head coaches records for leagues of interests active between 2018 and 2022\""
]
},
"metadata": {},
"output_type": "display_data"
}
],
"source": [
"# Select head-coach that have been active between 2018 and 2022\n",
"head_coach_bis <- head_coach_bis[is.na(head_coach_bis$end_date) | head_coach_bis$end_date >= \"2018-01-01\",]\n",
Expand All @@ -218,8 +342,8 @@
},
{
"cell_type": "code",
"execution_count": null,
"id": "14",
"execution_count": 11,
"id": "100b16e6",
"metadata": {
"vscode": {
"languageId": "r"
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 7d8f3da

Please sign in to comment.