{
"cells": [
{
"cell_type": "markdown",
"id": "b2cd2177",
"metadata": {},
"source": [
"Players dataset creation\n",
"\n",
"The Fantacalcio players list is manually downloaded from https://www.fantacalcio.it/quotazioni-fantacalcio\n",
"\n",
"Here, the players database is generated, by merging the Fantacalcio list to stats downloaded from http://fbref.com"
]
},
{
"cell_type": "code",
"execution_count": 24,
"id": "7c65df92",
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "markdown",
"id": "5ab35d0c",
"metadata": {},
"source": [
"Load fbref data for outfield players and goalkeepers.\n",
"\n",
"Generate fbref player list, adding player surname (with special characters replaced to normal ones)"
]
},
{
"cell_type": "code",
"execution_count": 25,
"id": "b2d7073e",
"metadata": {},
"outputs": [],
"source": [
"rcsv = pd.read_csv('fbref_data/outfield_players.csv') \n",
"outfield_players = pd.DataFrame(rcsv)\n",
"\n",
"rcsv = pd.read_csv('fbref_data/keepers_players.csv') \n",
"keeper_players = pd.DataFrame(rcsv)"
]
},
{
"cell_type": "code",
"execution_count": 26,
"id": "667970f6",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"
\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" player | \n",
" team | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" Tammy Abraham | \n",
" Roma | \n",
"
\n",
" \n",
" | 1 | \n",
" Francesco Acerbi | \n",
" Inter | \n",
"
\n",
" \n",
" | 2 | \n",
" Yacine Adli | \n",
" Milan | \n",
"
\n",
" \n",
" | 3 | \n",
" Michel Aebischer | \n",
" Bologna | \n",
"
\n",
" \n",
" | 4 | \n",
" Felix Afena-Gyan | \n",
" Cremonese | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 545 | \n",
" Ciprian Tătărușanu | \n",
" Milan | \n",
"
\n",
" \n",
" | 546 | \n",
" Pietro Terracciano | \n",
" Fiorentina | \n",
"
\n",
" \n",
" | 547 | \n",
" Guglielmo Vicario | \n",
" Empoli | \n",
"
\n",
" \n",
" | 548 | \n",
" Jeroen Zoet | \n",
" Spezia | \n",
"
\n",
" \n",
" | 549 | \n",
" Petar Zovko | \n",
" Spezia | \n",
"
\n",
" \n",
"
\n",
"
550 rows × 2 columns
\n",
"
"
],
"text/plain": [
" player team\n",
"0 Tammy Abraham Roma\n",
"1 Francesco Acerbi Inter\n",
"2 Yacine Adli Milan\n",
"3 Michel Aebischer Bologna\n",
"4 Felix Afena-Gyan Cremonese\n",
".. ... ...\n",
"545 Ciprian Tătărușanu Milan\n",
"546 Pietro Terracciano Fiorentina\n",
"547 Guglielmo Vicario Empoli\n",
"548 Jeroen Zoet Spezia\n",
"549 Petar Zovko Spezia\n",
"\n",
"[550 rows x 2 columns]"
]
},
"execution_count": 26,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"players = pd.concat( [ outfield_players[['player', 'team']], keeper_players[['player', 'team']] ], axis = 0, ignore_index = True)\n",
"\n",
"players"
]
},
{
"cell_type": "code",
"execution_count": 27,
"id": "e1e64596",
"metadata": {},
"outputs": [],
"source": [
"import unicodedata\n",
"\n",
"def normalize_name(input_str):\n",
" nfkd_form = unicodedata.normalize('NFKD', input_str)\n",
" only_ascii = nfkd_form.encode('ASCII', 'ignore')\n",
" return only_ascii.decode('utf-8')"
]
},
{
"cell_type": "code",
"execution_count": 28,
"id": "3078d6f3",
"metadata": {},
"outputs": [],
"source": [
"players['surname'] = players['player']\n",
"players['initial'] = players['player']\n",
"\n",
"for i in range(players.shape[0]):\n",
" players['surname'][i] = players['surname'][i].split(' ')[-1]\n",
" players['surname'][i] = normalize_name(players['surname'][i]).replace('\\'', '')\n",
" \n",
" \n",
" players['initial'][i] = players['player'][i][0]"
]
},
{
"cell_type": "code",
"execution_count": 29,
"id": "ffd6091c",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
" player surname\n",
"0 Tammy Abraham Abraham\n",
"1 Francesco Acerbi Acerbi\n",
"2 Yacine Adli Adli\n",
"3 Michel Aebischer Aebischer\n",
"4 Felix Afena-Gyan Afena-Gyan\n",
"5 Kevin Agudelo Agudelo\n",
"6 Ola Aina Aina\n",
"7 Emanuel Aiwum Aiwum\n",
"8 Jean-Daniel Akpa-Akpro Akpa-Akpro\n",
"9 Luis Alberto Alberto\n",
"10 Agustín Álvarez Martínez Martinez\n",
"11 Kelvin Amian Amian\n",
"12 Bruno Amione Amione\n",
"13 Bruno Amione Amione\n",
"14 Ethan Ampadu Ampadu\n",
"15 Sofyan Amrabat Amrabat\n",
"16 Felipe Anderson Anderson\n",
"17 Janis Antiste Antiste\n",
"18 Marcos Antônio Antonio\n",
"19 Valentin Antov Antov\n",
"20 Marko Arnautović Arnautovic\n",
"21 Tolgay Arslan Arslan\n",
"22 Arthur Arthur\n",
"23 Santiago Ascacíbar Ascacibar\n",
"24 Kristoffer Askildsen Askildsen\n",
"25 Kristjan Asllani Asllani\n",
"26 Emil Audero Audero\n",
"27 Tommaso Augello Augello\n",
"28 Kaan Ayhan Ayhan\n",
"29 Jaime Báez Baez\n",
"30 Nedim Bajrami Bajrami\n",
"31 Tommaso Baldanzi Baldanzi\n",
"32 Fodé Ballo-Touré Ballo-Toure\n",
"33 Lameck Banda Banda\n",
"34 Filippo Bandinelli Bandinelli\n",
"35 Antonín Barák Barak\n",
"36 Antonín Barák Barak\n",
"37 Andrea Barberis Barberis\n",
"38 Nicolò Barella Barella\n",
"39 Musa Barrow Barrow\n",
"40 Federico Baschirotto Baschirotto\n",
"41 Toma Bašić Basic\n",
"42 Alessandro Bastoni Bastoni\n",
"43 Simone Bastoni Bastoni\n",
"44 Rodrigo Becão Becao\n",
"45 Julius Beck Beck\n",
"46 Raoul Bellanova Bellanova\n",
"47 Andrea Belotti Belotti\n",
"48 Marco Benassi Benassi\n",
"49 Marco Benassi Benassi\n",
"50 Ismaël Bennacer Bennacer\n",
"51 Domenico Berardi Berardi\n",
"52 Bartosz Bereszyński Bereszynski\n",
"53 Beto Beto\n",
"54 Matteo Bianchetti Bianchetti\n",
"55 Alessandro Bianco Bianco\n",
"56 Jaka Bijol Bijol\n",
"57 Cristiano Biraghi Biraghi\n",
"58 Samuele Birindelli Birindelli\n",
"59 Kristijan Bistrović Bistrovic\n",
"60 Alexis Blin Blin\n",
"61 Jeremie Boga Boga\n",
"62 Emil Bohinen Bohinen\n",
"63 Giacomo Bonaventura Bonaventura\n",
"64 Federico Bonazzoli Bonazzoli\n",
"65 Warren Bondo Bondo\n",
"66 Kevin Bonifazi Bonifazi\n",
"67 Leonardo Bonucci Bonucci\n",
"68 Erik Botheim Botheim\n",
"69 Mehdi Bourabia Bourabia\n",
"70 Edoardo Bove Bove\n",
"71 Domagoj Bradarić Bradaric\n",
"72 Gleison Bremer Bremer\n",
"73 Dylan Bronn Bronn\n",
"74 Marcelo Brozović Brozovic\n",
"75 Cristian Buonaiuto Buonaiuto\n",
"76 Alessandro Buongiorno Buongiorno\n",
"77 Juan Cabal Cabal\n",
"78 Liberato Cacace Cacace\n",
"79 Davide Calabria Calabria\n",
"80 Mattia Caldara Caldara\n",
"81 Luca Caldirola Caldirola\n",
"82 Hakan Çalhanoğlu Calhanoglu\n",
"83 Mohamed Camara Camara\n",
"84 Nicolò Cambiaghi Cambiaghi\n",
"85 Andrea Cambiaso Cambiaso\n",
"86 Matteo Cancellieri Cancellieri\n",
"87 Antonio Candreva Candreva\n",
"88 Gianluca Caprari Caprari\n",
"89 Francesco Caputo Caputo\n",
"90 Francesco Caputo Caputo\n",
"91 Andrea Carboni Carboni\n",
"92 Valentin Carboni Carboni\n",
"93 Carlos Carlos\n",
"94 Marco Carnesecchi Carnesecchi\n",
"95 Nicolò Casale Casale\n",
"96 Michele Castagnetti Castagnetti\n",
"97 Gaetano Castrovilli Castrovilli\n",
"98 Danilo Cataldi Cataldi\n",
"99 Federico Ceccherini Ceccherini\n",
"100 Assan Ceesay Ceesay\n",
"101 Emil Ceide Ceide\n",
"102 Zeki Çelik Celik\n",
"103 Federico Chiesa Chiesa\n",
"104 Vlad Chiricheș Chiriches\n",
"105 Daniel Ciofani Ciofani\n",
"106 Tio Cipot Cipot\n",
"107 Patrick Ciurria Ciurria\n",
"108 Omar Colley Colley\n",
"109 Lorenzo Colombo Colombo\n",
"110 Andrea Colpani Colpani\n",
"111 Andrea Consigli Consigli\n",
"112 Andrea Conti Conti\n",
"113 Diego Coppola Coppola\n",
"114 Joaquín Correa Correa\n",
"115 Alessandro Cortinovis Cortinovis\n",
"116 Lassana Coulibaly Coulibaly\n",
"117 Bryan Cristante Cristante\n",
"118 Domen Črnigoj Crnigoj\n",
"119 Juan Cuadrado Cuadrado\n",
"120 Marco D'Alessandro DAlessandro\n",
"121 Danilo D'Ambrosio DAmbrosio\n",
"122 Luca D'Andrea DAndrea\n",
"123 Flavius Daniliuc Daniliuc\n",
"124 Danilo Danilo\n",
"125 Matteo Darmian Darmian\n",
"126 Paweł Dawidowicz Dawidowicz\n",
"127 Charles De Ketelaere Ketelaere\n",
"128 Manuel De Luca Luca\n",
"129 Mattia De Sciglio Sciglio\n",
"130 Lorenzo De Silvestri Silvestri\n",
"131 Koni De Winter Winter\n",
"132 Grégoire Defrel Defrel\n",
"133 Duccio Degli Innocenti Innocenti\n",
"134 Merih Demiral Demiral\n",
"135 Diego Demme Demme\n",
"136 Fabio Depaoli Depaoli\n",
"137 Fabio Depaoli Depaoli\n",
"138 Kastriot Dermaku Dermaku\n",
"139 Cyriel Dessers Dessers\n",
"140 Sergiño Dest Dest\n",
"141 Mattia Destro Destro\n",
"142 Gerard Deulofeu Deulofeu\n",
"143 Samuel Di Carmine Carmine\n",
"144 Federico Di Francesco Francesco\n",
"145 Michele Di Gregorio Gregorio\n",
"146 Giovanni Di Lorenzo Lorenzo\n",
"147 Ángel Di María Maria\n",
"148 Boulaye Dia Dia\n",
"149 Brahim Díaz Diaz\n",
"150 Federico Dimarco Dimarco\n",
"151 Koffi Djidji Djidji\n",
"152 Berat Djimsiti Djimsiti\n",
"153 Dodô Dodo\n",
"154 Josh Doig Doig\n",
"155 Nicolás Domínguez Dominguez\n",
"156 Giulio Donati Donati\n",
"157 Bartłomiej Drągowski Dragowski\n",
"158 Denzel Dumfries Dumfries\n",
"159 Alfred Duncan Duncan\n",
"160 Paulo Dybala Dybala\n",
"161 Edin Džeko Dzeko\n",
"162 Festy Ebosele Ebosele\n",
"163 Enzo Ebosse Ebosse\n",
"164 Tyronne Ebuehi Ebuehi\n",
"165 Éderson Ederson\n",
"166 Kingsley Ehizibue Ehizibue\n",
"167 Albin Ekdal Ekdal\n",
"168 Emmanuel Ekong Ekong\n",
"169 Mikael Ellertsson Ellertsson\n",
"170 Elif Elmas Elmas\n",
"171 Martin Erlic Erlic\n",
"172 Gonzalo Escalante Escalante\n",
"173 Salvatore Esposito Esposito\n",
"174 Nicolò Fagioli Fagioli\n",
"175 Wladimiro Falcone Falcone\n",
"176 Davide Faraoni Faraoni\n",
"177 Federico Fazio Fazio\n",
"178 Jacopo Fazzini Fazzini\n",
"179 Lewis Ferguson Ferguson\n",
"180 Alex Ferrari Ferrari\n",
"181 Alex Ferrari Ferrari\n",
"182 Salvador Ferrer Ferrer\n",
"183 Alessandro Florenzi Florenzi\n",
"184 Davide Frattesi Frattesi\n",
"185 Matteo Gabbia Gabbia\n",
"186 Manolo Gabbiadini Gabbiadini\n",
"187 Gianluca Gaetano Gaetano\n",
"188 Roberto Gagliardini Gagliardini\n",
"189 Antonino Gallo Gallo\n",
"190 Federico Gatti Gatti\n",
"191 Valentin Gendrey Gendrey\n",
"192 Paolo Ghiglione Ghiglione\n",
"193 Mario Gila Gila\n",
"194 Olivier Giroud Giroud\n",
"195 Pierluigi Gollini Gollini\n",
"196 Joan Gonzàlez Gonzalez\n",
"197 Nicolás González Gonzalez\n",
"198 Robin Gosens Gosens\n",
"199 Alberto Grassi Grassi\n",
"200 Koray Günter Gunter\n",
"201 Emmanuel Gyasi Gyasi\n",
"202 Norbert Gyömbér Gyomber\n",
"203 Christian Gytkjær Gytkjr\n",
"204 Nicolas Haas Haas\n",
"205 Samir Handanović Handanovic\n",
"206 Abdou Harroui Harroui\n",
"207 Hans Hateboer Hateboer\n",
"208 Liam Henderson Henderson\n",
"209 Jack Hendry Hendry\n",
"210 Matheus Henrique Henrique\n",
"211 Thomas Henry Henry\n",
"212 Theo Hernández Hernandez\n",
"213 Isak Hien Hien\n",
"214 Morten Hjulmand Hjulmand\n",
"215 Emil Holm Holm\n",
"216 Martin Hongla Hongla\n",
"217 Petko Hristov Hristov\n",
"218 Ajdin Hrustic Hrustic\n",
"219 Elseid Hysaj Hysaj\n",
"220 Rasmus Højlund Hjlund\n",
"221 Roger Ibanez Ibanez\n",
"222 Igor Igor\n",
"223 Jonathan Ikone Ikone\n",
"224 Ivan Ilić Ilic\n",
"225 Samuel Iling-Junior Iling-Junior\n",
"226 Emirhan İlkhan Ilkhan\n",
"227 Ciro Immobile Immobile\n",
"228 Ardian Ismajli Ismajli\n",
"229 Armando Izzo Izzo\n",
"230 Mato Jajalo Jajalo\n",
"231 Juan Jesus Jesus\n",
"232 Þórir Jóhann Helgason Helgason\n",
"233 Luka Jović Jovic\n",
"234 Hamed Junior Traorè Traore\n",
"235 Yayah Kallon Kallon\n",
"236 Pierre Kalulu Kalulu\n",
"237 Yann Karamoh Karamoh\n",
"238 Rick Karsdorp Karsdorp\n",
"239 Denso Kasius Kasius\n",
"240 Grigoris Kastanos Kastanos\n",
"241 Moise Kean Kean\n",
"242 Jakub Kiwior Kiwior\n",
"243 Simon Kjær Kjr\n",
"244 Teun Koopmeiners Koopmeiners\n",
"245 Filip Kostić Kostic\n",
"246 Christian Kouamé Kouame\n",
"247 Viktor Kovalenko Kovalenko\n",
"248 Julian Kristoffersen Kristoffersen\n",
"249 Rade Krunić Krunic\n",
"250 Marash Kumbulla Kumbulla\n",
"251 Khvicha Kvaratskhelia Kvaratskhelia\n",
"252 Giorgos Kyriakopoulos Kyriakopoulos\n",
"253 Sam Lammers Lammers\n",
"254 Sam Lammers Lammers\n",
"255 Kevin Lasagna Lasagna\n",
"256 Armand Lauriente Lauriente\n",
"257 Valentino Lazaro Lazaro\n",
"258 Marko Lazetić Lazetic\n",
"259 Darko Lazović Lazovic\n",
"260 Manuel Lazzari Lazzari\n",
"261 Rafael Leão Leao\n",
"262 Mehdi Léris Leris\n",
"263 Karol Linetty Linetty\n",
"264 Marcin Listkowski Listkowski\n",
"265 Stanislav Lobotka Lobotka\n",
"266 Manuel Locatelli Locatelli\n",
"267 Luka Lochoshvili Lochoshvili\n",
"268 Ademola Lookman Lookman\n",
"269 Maxime Lopez Lopez\n",
"270 Matteo Lovato Lovato\n",
"271 Sandi Lovrić Lovric\n",
"272 Hirving Lozano Lozano\n",
"273 Jhon Lucumí Lucumi\n",
"274 José Luis Palomino Palomino\n",
"275 Romelu Lukaku Lukaku\n",
"276 Saša Lukić Lukic\n",
"277 Sebastiano Luperto Luperto\n",
"278 Charalambos Lykogiannis Lykogiannis\n",
"279 Giulio Maggiore Maggiore\n",
"280 Giangiacomo Magnani Magnani\n",
"281 Mike Maignan Maignan\n",
"282 Jean-Victor Makengo Makengo\n",
"283 Daniel Maldini Maldini\n",
"284 Youssef Maleh Maleh\n",
"285 Youssef Maleh Maleh\n",
"286 Ruslan Malinovskyi Malinovskyi\n",
"287 Gianluca Mancini Mancini\n",
"288 Rolando Mandragora Mandragora\n",
"289 Riccardo Marchizza Marchizza\n",
"290 Gian Marco Ferrari Ferrari\n",
"291 Pablo Marí Mari\n",
"292 Răzvan Marin Marin\n",
"293 Marlon Marlon\n",
"294 Luca Marrone Marrone\n",
"295 Lautaro Martínez Martinez\n",
"296 Lucas Martínez Quarta Quarta\n",
"297 Adam Marušić Marusic\n",
"298 Adam Masina Masina\n",
"299 Nemanja Matić Matic\n",
"300 Luís Maximiano Maximiano\n",
"301 Pasquale Mazzocchi Mazzocchi\n",
"302 Weston McKennie McKennie\n",
"303 Gary Medel Medel\n",
"304 Soualiho Meïté Meite\n",
"305 Alex Meret Meret\n",
"306 Yıldırım Mert Çetin Cetin\n",
"307 Junior Messias Messias\n",
"308 Tommaso Milanese Milanese\n",
"309 Nikola Milenković Milenkovic\n",
"310 Arkadiusz Milik Milik\n",
"311 Sergej Milinković-Savić Milinkovic-Savic\n",
"312 Vanja Milinković-Savić Milinkovic-Savic\n",
"313 Kim Min-jae Min-jae\n",
"314 Aleksei Miranchuk Miranchuk\n",
"315 Fabio Miretti Miretti\n",
"316 Henrikh Mkhitaryan Mkhitaryan\n",
"317 Salvatore Molina Molina\n",
"318 Daniele Montevago Montevago\n",
"319 Lorenzo Montipò Montipo\n",
"320 Nikola Moro Moro\n",
"321 Dany Mota Mota\n",
"322 João Moutinho Moutinho\n",
"323 Mert Müldür Muldur\n",
"324 Luis Muriel Muriel\n",
"325 Jeison Murillo Murillo\n",
"326 Nicola Murru Murru\n",
"327 Juan Musso Musso\n",
"328 Joakim Mæhle Mhle\n",
"329 Michel Ndary Adopo Adopo\n",
"330 Tanguy Ndombele Ndombele\n",
"331 Ilija Nestorovski Nestorovski\n",
"332 Hans Nicolussi Caviglia Caviglia\n",
"333 Dimitris Nikolaou Nikolaou\n",
"334 Bram Nuytinck Nuytinck\n",
"335 Bram Nuytinck Nuytinck\n",
"336 M'Bala Nzola Nzola\n",
"337 Pedro Obiang Obiang\n",
"338 Guillermo Ochoa Ochoa\n",
"339 David Okereke Okereke\n",
"340 Caleb Okoli Okoli\n",
"341 Mathías Olivera Olivera\n",
"342 André Onana Onana\n",
"343 Divock Origi Origi\n",
"344 Riccardo Orsolini Orsolini\n",
"345 Victor Osimhen Osimhen\n",
"346 Remi Oudin Oudin\n",
"347 Adam Ounas Ounas\n",
"348 Flavio Paoletti Paoletti\n",
"349 Leandro Paredes Paredes\n",
"350 Fabiano Parisi Parisi\n",
"351 Mario Pašalić Pasalic\n",
"352 Patric Patric\n",
"353 Rui Patrício Patricio\n",
"354 Pedro Pedro\n",
"355 Gianluca Pegolo Pegolo\n",
"356 Pietro Pellegri Pellegri\n",
"357 Lorenzo Pellegrini Pellegrini\n",
"358 Pepín Pepin\n",
"359 Roberto Pereyra Pereyra\n",
"360 Nehuén Pérez Perez\n",
"361 Mattia Perin Perin\n",
"362 Matteo Pessina Pessina\n",
"363 Andrea Petagna Petagna\n",
"364 Giuseppe Pezzella Pezzella\n",
"365 Krzysztof Piątek Piatek\n",
"366 Roberto Piccoli Piccoli\n",
"367 Charles Pickel Pickel\n",
"368 Andrea Pinamonti Pinamonti\n",
"369 Lorenzo Pirola Pirola\n",
"370 Marko Pjaca Pjaca\n",
"371 Tommaso Pobega Pobega\n",
"372 Matteo Politano Politano\n",
"373 Marin Pongračić Pongracic\n",
"374 Stefan Posch Posch\n",
"375 Ivan Provedel Provedel\n",
"376 Ignacio Pussetto Pussetto\n",
"377 Niklas Pyyhtiä Pyyhtia\n",
"378 Fabio Quagliarella Quagliarella\n",
"379 Giacomo Quagliata Quagliata\n",
"380 Adrien Rabiot Rabiot\n",
"381 Nemanja Radonjić Radonjic\n",
"382 Ivan Radovanović Radovanovic\n",
"383 Ionuț Radu Radu\n",
"384 Luca Ranieri Ranieri\n",
"385 Andrea Ranocchia Ranocchia\n",
"386 Filippo Ranocchia Ranocchia\n",
"387 Giacomo Raspadori Raspadori\n",
"388 Giacomo Raspadori Raspadori\n",
"389 Ante Rebić Rebic\n",
"390 Arkadiusz Reca Reca\n",
"391 Panagiotis Retsos Retsos\n",
"392 Franck Ribéry Ribery\n",
"393 Samuele Ricci Ricci\n",
"394 Tomás Rincón Rincon\n",
"395 Pablo Rodríguez Rodriguez\n",
"396 Ricardo Rodríguez Rodriguez\n",
"397 Rogério Rogerio\n",
"398 Alessio Romagnoli Romagnoli\n",
"399 Luka Romero Romero\n",
"400 Marten de Roon Roon\n",
"401 Nicolò Rovella Rovella\n",
"402 Nicolò Rovella Rovella\n",
"403 Amir Rrahmani Rrahmani\n",
"404 Ruan Ruan\n",
"405 Daniele Rugani Rugani\n",
"406 Matteo Ruggeri Ruggeri\n",
"407 Mário Rui Rui\n",
"408 Abdelhamid Sabiri Sabiri\n",
"409 Alexis Saelemaekers Saelemaekers\n",
"410 Jacopo Sala Sala\n",
"411 Lazar Samardzic Samardzic\n",
"412 Junior Sambia Sambia\n",
"413 Antonio Sanabria Sanabria\n",
"414 Leandro Sanca Sanca\n",
"415 Alex Sandro Sandro\n",
"416 Nicola Sansone Sansone\n",
"417 Riccardo Saponara Saponara\n",
"418 Martin Satriano Satriano\n",
"419 Giorgio Scalvini Scalvini\n",
"420 Jerdy Schouten Schouten\n",
"421 Perr Schuurs Schuurs\n",
"422 Demba Seck Seck\n",
"423 Jacopo Segre Segre\n",
"424 Stefano Sensi Sensi\n",
"425 Luigi Sepe Sepe\n",
"426 Leonardo Sernicola Sernicola\n",
"427 Stephan El Shaarawy Shaarawy\n",
"428 Eldor Shomurodov Shomurodov\n",
"429 Marco Silvestri Silvestri\n",
"430 Giovanni Simeone Simeone\n",
"431 Wilfried Singo Singo\n",
"432 Leo Skiri Østigård stigard\n",
"433 Łukasz Skorupski Skorupski\n",
"434 Milan Škriniar Skriniar\n",
"435 Chris Smalling Smalling\n",
"436 Ola Solbakken Solbakken\n",
"437 Brandon Soppy Soppy\n",
"438 Brandon Soppy Soppy\n",
"439 Roberto Soriano Soriano\n",
"440 Joaquin Sosa Sosa\n",
"441 Riccardo Sottil Sottil\n",
"442 Matìas Soulé Soule\n",
"443 Adama Soumaoro Soumaoro\n",
"444 Leonardo Spinazzola Spinazzola\n",
"445 Marco Sportiello Sportiello\n",
"446 Petar Stojanović Stojanovic\n",
"447 Gabriel Strefezza Strefezza\n",
"448 Dávid Strelec Strelec\n",
"449 Isaac Success Success\n",
"450 Ibrahim Sulemana Sulemana\n",
"451 Wojciech Szczęsny Szczesny\n",
"452 Benjamin Tahirovic Tahirovic\n",
"453 Adrien Tameze Tameze\n",
"454 Ciprian Tătărușanu Tatarusanu\n",
"455 Filippo Terracciano Terracciano\n",
"456 Pietro Terracciano Terracciano\n",
"457 Aleksa Terzić Terzic\n",
"458 Malick Thiaw Thiaw\n",
"459 Kristian Thorstvedt Thorstvedt\n",
"460 Jeremy Toljan Toljan\n",
"461 Rafael Tolói Toloi\n",
"462 Fikayo Tomori Tomori\n",
"463 Sandro Tonali Tonali\n",
"464 William Troost-Ekong Troost-Ekong\n",
"465 Frank Tsadjout Tsadjout\n",
"466 Alessandro Tuia Tuia\n",
"467 Iyenoma Udogie Udogie\n",
"468 Samuel Umtiti Umtiti\n",
"469 Diego Valencia Valencia\n",
"470 Emanuele Valeri Valeri\n",
"471 Mattia Valoti Valoti\n",
"472 Johan Vásquez Vasquez\n",
"473 Matías Vecino Vecino\n",
"474 Miguel Veloso Veloso\n",
"475 Lorenzo Venuti Venuti\n",
"476 Daniele Verde Verde\n",
"477 Simone Verdi Verdi\n",
"478 Valerio Verre Verre\n",
"479 Guglielmo Vicario Vicario\n",
"480 Ronaldo Vieira Vieira\n",
"481 Emanuel Vignato Vignato\n",
"482 Samuele Vignato Vignato\n",
"483 Tonny Vilhena Vilhena\n",
"484 Gonzalo Villar Villar\n",
"485 Matías Viña Vina\n",
"486 Dušan Vlahović Vlahovic\n",
"487 Nikola Vlašić Vlasic\n",
"488 Joel Voelkerling Persson Persson\n",
"489 Mërgim Vojvoda Vojvoda\n",
"490 Cristian Volpato Volpato\n",
"491 Aster Vranckx Vranckx\n",
"492 Stefan de Vrij Vrij\n",
"493 Walace Walace\n",
"494 Sebastian Walukiewicz Walukiewicz\n",
"495 Georginio Wijnaldum Wijnaldum\n",
"496 Harry Winks Winks\n",
"497 Gerard Yepes Yepes\n",
"498 Mattia Zaccagni Zaccagni\n",
"499 Denis Zakaria Zakaria\n",
"500 Nicola Zalewski Zalewski\n",
"501 Andre-Frank Zambo Anguissa Anguissa\n",
"502 Luca Zanimacchia Zanimacchia\n",
"503 Nicolò Zaniolo Zaniolo\n",
"504 Alessandro Zanoli Zanoli\n",
"505 Alessandro Zanoli Zanoli\n",
"506 Duván Zapata Zapata\n",
"507 Davide Zappacosta Zappacosta\n",
"508 Alessio Zerbin Zerbin\n",
"509 Piotr Zieliński Zielinski\n",
"510 David Zima Zima\n",
"511 Joshua Zirkzee Zirkzee\n",
"512 Jeroen Zoet Zoet\n",
"513 Nadir Zortea Zortea\n",
"514 Petar Zovko Zovko\n",
"515 Szymon Żurkowski Zurkowski\n",
"516 Szymon Żurkowski Zurkowski\n",
"517 Milan Đurić uric\n",
"518 Filip Đuričić uricic\n",
"519 Emil Audero Audero\n",
"520 Marco Carnesecchi Carnesecchi\n",
"521 Andrea Consigli Consigli\n",
"522 Michele Di Gregorio Gregorio\n",
"523 Bartłomiej Drągowski Dragowski\n",
"524 Wladimiro Falcone Falcone\n",
"525 Pierluigi Gollini Gollini\n",
"526 Samir Handanović Handanovic\n",
"527 Mike Maignan Maignan\n",
"528 Luís Maximiano Maximiano\n",
"529 Alex Meret Meret\n",
"530 Vanja Milinković-Savić Milinkovic-Savic\n",
"531 Lorenzo Montipò Montipo\n",
"532 Juan Musso Musso\n",
"533 Guillermo Ochoa Ochoa\n",
"534 André Onana Onana\n",
"535 Rui Patrício Patricio\n",
"536 Gianluca Pegolo Pegolo\n",
"537 Mattia Perin Perin\n",
"538 Ivan Provedel Provedel\n",
"539 Ionuț Radu Radu\n",
"540 Luigi Sepe Sepe\n",
"541 Marco Silvestri Silvestri\n",
"542 Łukasz Skorupski Skorupski\n",
"543 Marco Sportiello Sportiello\n",
"544 Wojciech Szczęsny Szczesny\n",
"545 Ciprian Tătărușanu Tatarusanu\n",
"546 Pietro Terracciano Terracciano\n",
"547 Guglielmo Vicario Vicario\n",
"548 Jeroen Zoet Zoet\n",
"549 Petar Zovko Zovko\n"
]
}
],
"source": [
"print(players[['player', 'surname']].to_string())"
]
},
{
"cell_type": "markdown",
"id": "9ab06a5c",
"metadata": {},
"source": [
"Replace the surname for some specific players, according to config/name_fix.txt file.\n",
"\n",
"This is done for players for which the decoded fbref surname doesn't correspond to Fantacalcio list."
]
},
{
"cell_type": "code",
"execution_count": 30,
"id": "3e759b1b",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Ostigard\n",
"Kim\n",
"Hojlund\n",
"Gytkjaer\n",
"Augusto\n",
"Maehle\n",
"Kjaer\n",
"Djuricic\n",
"Djuric\n",
"Cabral\n",
"Alvarez\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" FROM | \n",
" TO | \n",
" TEAM | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" stigard | \n",
" Ostigard | \n",
" Napoli | \n",
"
\n",
" \n",
" | 1 | \n",
" Min-jae | \n",
" Kim | \n",
" Napoli | \n",
"
\n",
" \n",
" | 2 | \n",
" Hjlund | \n",
" Hojlund | \n",
" Atalanta | \n",
"
\n",
" \n",
" | 3 | \n",
" Gytkjr | \n",
" Gytkjaer | \n",
" Monza | \n",
"
\n",
" \n",
" | 4 | \n",
" Carlos | \n",
" Augusto | \n",
" Monza | \n",
"
\n",
" \n",
" | 5 | \n",
" Mhle | \n",
" Maehle | \n",
" Atalanta | \n",
"
\n",
" \n",
" | 6 | \n",
" Kjr | \n",
" Kjaer | \n",
" Milan | \n",
"
\n",
" \n",
" | 7 | \n",
" uricic | \n",
" Djuricic | \n",
" Sampdoria | \n",
"
\n",
" \n",
" | 8 | \n",
" uric | \n",
" Djuric | \n",
" Hellas Verona | \n",
"
\n",
" \n",
" | 9 | \n",
" Arthur | \n",
" Cabral | \n",
" Fiorentina | \n",
"
\n",
" \n",
" | 10 | \n",
" Martinez | \n",
" Alvarez | \n",
" Sassuolo | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" FROM TO TEAM\n",
"0 stigard Ostigard Napoli\n",
"1 Min-jae Kim Napoli\n",
"2 Hjlund Hojlund Atalanta\n",
"3 Gytkjr Gytkjaer Monza\n",
"4 Carlos Augusto Monza\n",
"5 Mhle Maehle Atalanta\n",
"6 Kjr Kjaer Milan\n",
"7 uricic Djuricic Sampdoria\n",
"8 uric Djuric Hellas Verona\n",
"9 Arthur Cabral Fiorentina\n",
"10 Martinez Alvarez Sassuolo"
]
},
"execution_count": 30,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"rcsv = pd.read_csv('config/name_fix.txt') \n",
"name_fix = pd.DataFrame(rcsv)\n",
"\n",
"for i in range(name_fix.shape[0]):\n",
" for j in range(players.shape[0]):\n",
" if(players['surname'][j].lower() == name_fix['FROM'][i].lower() and players['team'][j].lower() == name_fix['TEAM'][i].lower()):\n",
" players['surname'][j] = name_fix['TO'][i]\n",
" print(name_fix['TO'][i])\n",
"\n",
"name_fix\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "3c686d9f",
"metadata": {},
"source": [
"Load players from Fantacalcio list."
]
},
{
"cell_type": "code",
"execution_count": 31,
"id": "f96eaaa1",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2263921821.py:17: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['surname'][i] = spl[-1]\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2263921821.py:18: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['initial'][i] = ''\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2263921821.py:14: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['surname'][i] = spl[-2]\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2263921821.py:15: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['initial'][i] = spl[-1][0]\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" id | \n",
" r | \n",
" name | \n",
" team | \n",
" surname | \n",
" initial | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 572 | \n",
" P | \n",
" Meret | \n",
" Napoli | \n",
" Meret | \n",
" | \n",
"
\n",
" \n",
" | 1 | \n",
" 2814 | \n",
" P | \n",
" Provedel | \n",
" Lazio | \n",
" Provedel | \n",
" | \n",
"
\n",
" \n",
" | 2 | \n",
" 4964 | \n",
" P | \n",
" Vicario | \n",
" Empoli | \n",
" Vicario | \n",
" | \n",
"
\n",
" \n",
" | 3 | \n",
" 453 | \n",
" P | \n",
" Szczesny | \n",
" Juventus | \n",
" Szczesny | \n",
" | \n",
"
\n",
" \n",
" | 4 | \n",
" 2134 | \n",
" P | \n",
" Falcone | \n",
" Lecce | \n",
" Falcone | \n",
" | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 5505 | \n",
" A | \n",
" Kaio Jorge | \n",
" Juventus | \n",
" Jorge | \n",
" | \n",
"
\n",
" \n",
" | 543 | \n",
" 5512 | \n",
" A | \n",
" De Luca | \n",
" Sampdoria | \n",
" Luca | \n",
" | \n",
"
\n",
" \n",
" | 544 | \n",
" 5785 | \n",
" A | \n",
" Lazetic | \n",
" Milan | \n",
" Lazetic | \n",
" | \n",
"
\n",
" \n",
" | 545 | \n",
" 6113 | \n",
" A | \n",
" Montevago | \n",
" Sampdoria | \n",
" Montevago | \n",
" | \n",
"
\n",
" \n",
" | 546 | \n",
" 6143 | \n",
" A | \n",
" Krollis | \n",
" Spezia | \n",
" Krollis | \n",
" | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 6 columns
\n",
"
"
],
"text/plain": [
" id r name team surname initial\n",
"0 572 P Meret Napoli Meret \n",
"1 2814 P Provedel Lazio Provedel \n",
"2 4964 P Vicario Empoli Vicario \n",
"3 453 P Szczesny Juventus Szczesny \n",
"4 2134 P Falcone Lecce Falcone \n",
".. ... .. ... ... ... ...\n",
"542 5505 A Kaio Jorge Juventus Jorge \n",
"543 5512 A De Luca Sampdoria Luca \n",
"544 5785 A Lazetic Milan Lazetic \n",
"545 6113 A Montevago Sampdoria Montevago \n",
"546 6143 A Krollis Spezia Krollis \n",
"\n",
"[547 rows x 6 columns]"
]
},
"execution_count": 31,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_data = pd.read_excel('fantacalcio/Quotazioni_Fantacalcio.xlsx', 'Tutti', header = 1)\n",
"\n",
"fc_players = fc_data [['Id', 'R', 'Nome', 'Squadra']]\n",
"\n",
"fc_players = fc_players.rename(columns = {'Id' : 'id', 'R': 'r', 'Nome' : 'name', 'Squadra' : 'team'})\n",
"\n",
"fc_players['surname'] = fc_players['name']\n",
"fc_players['initial'] = fc_players['name']\n",
"\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" spl = normalize_name( fc_players['name'][i].replace('\\'', '') ).split(' ')\n",
" if('.' in spl[-1]):\n",
" fc_players['surname'][i] = spl[-2]\n",
" fc_players['initial'][i] = spl[-1][0]\n",
" else:\n",
" fc_players['surname'][i] = spl[-1]\n",
" fc_players['initial'][i] = ''\n",
" \n",
"fc_players\n",
"\n"
]
},
{
"cell_type": "markdown",
"id": "d944c720",
"metadata": {},
"source": [
"Associate players from Fantacalcio list to ID for FBref data."
]
},
{
"cell_type": "code",
"execution_count": 32,
"id": "9c50e4b5",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\1456862974.py:4: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['fb_ID'][i] = -1\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\1456862974.py:10: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players['fb_ID'][i] = j\n"
]
}
],
"source": [
"fc_players['fb_ID'] = fc_players['id']\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" fc_players['fb_ID'][i] = -1\n",
" \n",
" for j in range(players.shape[0]):\n",
" if(fc_players['team'][i].lower() in players['team'][j].lower()):\n",
" if(fc_players['surname'][i].lower() == players['surname'][j].lower()):\n",
" # if(fc_players['initial'][i] == '' or fc_players['initial'][i].lower() == players['initial'][j].lower()):\n",
" fc_players['fb_ID'][i] = j\n",
" \n",
" "
]
},
{
"cell_type": "markdown",
"id": "4e60fd2e",
"metadata": {},
"source": [
"Print players for which the association failed.\n",
"\n",
"Most of them are players who didn't play a single Serie A game this season. \n",
"\n",
"Others are ones for which the FBRef surname doesn't correspond to Fantacalcio one.\n",
"\n",
"For example, Cabral is Arthur for FBref.\n",
"\n",
"Correction is made in the name_fix code above."
]
},
{
"cell_type": "code",
"execution_count": 33,
"id": "5a3e2771",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Gollini\n",
"Mirante\n",
"Sarr M.\n",
"Lamanna\n",
"Ujkani\n",
"Berisha\n",
"Marchetti\n",
"Perilli\n",
"Padelli\n",
"Perisan\n",
"Bardi\n",
"Cordaz\n",
"Pinsoglio\n",
"Fiorillo\n",
"Cragno\n",
"Sirigu\n",
"Cerofolini\n",
"Rossi F.\n",
"Ravaglia F.\n",
"Brancolini\n",
"Bleve\n",
"Berardi A.\n",
"Russo A.\n",
"Gemello\n",
"Ravaglia\n",
"Boer\n",
"Adamonis\n",
"Marfella\n",
"Piana\n",
"Bagnolini\n",
"Svilar\n",
"Sorrentino A.\n",
"Ciezkowski\n",
"Chiesa M.\n",
"Saro\n",
"Vasquez D.\n",
"Turk\n",
"Bereszynski\n",
"Aiwu\n",
"Zeefuik\n",
"Wisniewski\n",
"Tonelli\n",
"Radu\n",
"Paletta\n",
"Fares\n",
"Romagna\n",
"Cassandro\n",
"Amey\n",
"Ferrarini\n",
"Zanotti\n",
"Bayeye\n",
"Buta\n",
"Abankwah\n",
"Guessand A.\n",
"Guarino\n",
"Pogba\n",
"Machin\n",
"Akpa Akpro\n",
"Capezzi\n",
"Bakayoko\n",
"Scozzarella\n",
"Darboe\n",
"Urbanski\n",
"Bertini\n",
"Trimboli\n",
"Pafundi\n",
"Samek\n",
"Acella\n",
"Garbett\n",
"Ngonge\n",
"Ibrahimovic\n",
"Edera\n",
"Oddei\n",
"Braaf\n",
"Raimondo\n",
"Kaio Jorge\n",
"Krollis\n"
]
}
],
"source": [
"for i in range(fc_players.shape[0]):\n",
" if(fc_players['fb_ID'][i] == -1):\n",
" print(fc_players['name'][i])"
]
},
{
"cell_type": "code",
"execution_count": 34,
"id": "3b4a36af",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" id | \n",
" r | \n",
" name | \n",
" team | \n",
" surname | \n",
" initial | \n",
" fb_ID | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 572 | \n",
" P | \n",
" Meret | \n",
" Napoli | \n",
" Meret | \n",
" | \n",
" 529 | \n",
"
\n",
" \n",
" | 1 | \n",
" 2814 | \n",
" P | \n",
" Provedel | \n",
" Lazio | \n",
" Provedel | \n",
" | \n",
" 538 | \n",
"
\n",
" \n",
" | 2 | \n",
" 4964 | \n",
" P | \n",
" Vicario | \n",
" Empoli | \n",
" Vicario | \n",
" | \n",
" 547 | \n",
"
\n",
" \n",
" | 3 | \n",
" 453 | \n",
" P | \n",
" Szczesny | \n",
" Juventus | \n",
" Szczesny | \n",
" | \n",
" 544 | \n",
"
\n",
" \n",
" | 4 | \n",
" 2134 | \n",
" P | \n",
" Falcone | \n",
" Lecce | \n",
" Falcone | \n",
" | \n",
" 524 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 5505 | \n",
" A | \n",
" Kaio Jorge | \n",
" Juventus | \n",
" Jorge | \n",
" | \n",
" -1 | \n",
"
\n",
" \n",
" | 543 | \n",
" 5512 | \n",
" A | \n",
" De Luca | \n",
" Sampdoria | \n",
" Luca | \n",
" | \n",
" 128 | \n",
"
\n",
" \n",
" | 544 | \n",
" 5785 | \n",
" A | \n",
" Lazetic | \n",
" Milan | \n",
" Lazetic | \n",
" | \n",
" 258 | \n",
"
\n",
" \n",
" | 545 | \n",
" 6113 | \n",
" A | \n",
" Montevago | \n",
" Sampdoria | \n",
" Montevago | \n",
" | \n",
" 318 | \n",
"
\n",
" \n",
" | 546 | \n",
" 6143 | \n",
" A | \n",
" Krollis | \n",
" Spezia | \n",
" Krollis | \n",
" | \n",
" -1 | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 7 columns
\n",
"
"
],
"text/plain": [
" id r name team surname initial fb_ID\n",
"0 572 P Meret Napoli Meret 529\n",
"1 2814 P Provedel Lazio Provedel 538\n",
"2 4964 P Vicario Empoli Vicario 547\n",
"3 453 P Szczesny Juventus Szczesny 544\n",
"4 2134 P Falcone Lecce Falcone 524\n",
".. ... .. ... ... ... ... ...\n",
"542 5505 A Kaio Jorge Juventus Jorge -1\n",
"543 5512 A De Luca Sampdoria Luca 128\n",
"544 5785 A Lazetic Milan Lazetic 258\n",
"545 6113 A Montevago Sampdoria Montevago 318\n",
"546 6143 A Krollis Spezia Krollis -1\n",
"\n",
"[547 rows x 7 columns]"
]
},
"execution_count": 34,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_players"
]
},
{
"cell_type": "markdown",
"id": "f06afbb6",
"metadata": {},
"source": [
"Populate players dataset with stats from FBref, for outfield players and goalkeepers"
]
},
{
"cell_type": "code",
"execution_count": 35,
"id": "1d73a312",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy] = 0\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\2261782218.py:9: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players[columns_to_copy[j]][i] = outfield_players[columns_to_copy[j]][fc_players['fb_ID'][i]]\n"
]
}
],
"source": [
"#Data for Outfield players\n",
"columns_to_copy = outfield_players.columns[4:]\n",
"\n",
"fc_players[columns_to_copy] = 0\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" if(fc_players['fb_ID'][i] != -1 and fc_players['r'][i] != 'P'):\n",
" for j in range(columns_to_copy.shape[0]):\n",
" fc_players[columns_to_copy[j]][i] = outfield_players[columns_to_copy[j]][fc_players['fb_ID'][i]]\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 36,
"id": "7acb93e3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Index(['age', 'birth_year', 'gk_games', 'gk_games_starts', 'gk_minutes',\n",
" 'gk_goals_against', 'gk_goals_against_per90',\n",
" 'gk_shots_on_target_against', 'gk_saves', 'gk_save_pct', 'gk_wins',\n",
" 'gk_ties', 'gk_losses', 'gk_clean_sheets', 'gk_clean_sheets_pct',\n",
" 'gk_pens_att', 'gk_pens_allowed', 'gk_pens_saved', 'gk_pens_missed',\n",
" 'minutes_90s', 'gk_free_kick_goals_against',\n",
" 'gk_corner_kick_goals_against', 'gk_own_goals_against', 'gk_psxg',\n",
" 'gk_psnpxg_per_shot_on_target_against', 'gk_psxg_net',\n",
" 'gk_psxg_net_per90', 'gk_passes_completed_launched',\n",
" 'gk_passes_launched', 'gk_passes_pct_launched', 'gk_passes',\n",
" 'gk_passes_throws', 'gk_pct_passes_launched', 'gk_passes_length_avg',\n",
" 'gk_goal_kicks', 'gk_pct_goal_kicks_launched',\n",
" 'gk_goal_kick_length_avg', 'gk_crosses', 'gk_crosses_stopped',\n",
" 'gk_crosses_stopped_pct', 'gk_def_actions_outside_pen_area',\n",
" 'gk_def_actions_outside_pen_area_per90', 'gk_avg_distance_def_actions'],\n",
" dtype='object')"
]
},
"execution_count": 36,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"keeper_players.columns[4:]"
]
},
{
"cell_type": "code",
"execution_count": 37,
"id": "eb9127a9",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n",
" fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_14056\\3664433845.py:11: SettingWithCopyWarning: \n",
"A value is trying to be set on a copy of a slice from a DataFrame\n",
"\n",
"See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n",
" fc_players[columns_to_copy[j]][i] = keeper_players[columns_to_copy[j]][fc_players['fb_ID'][i] - delta_k]\n"
]
}
],
"source": [
"#Data for Keepers\n",
"columns_to_copy = keeper_players.columns[4:]\n",
"\n",
"fc_players[columns_to_copy[2:]] = 0 # add columns but do not override age and birth_year\n",
"\n",
"delta_k = outfield_players.shape[0]\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" if(fc_players['fb_ID'][i] != -1 and fc_players['r'][i] == 'P'):\n",
" for j in range(columns_to_copy.shape[0]):\n",
" fc_players[columns_to_copy[j]][i] = keeper_players[columns_to_copy[j]][fc_players['fb_ID'][i] - delta_k]"
]
},
{
"cell_type": "code",
"execution_count": 38,
"id": "da977789",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" id | \n",
" r | \n",
" name | \n",
" team | \n",
" surname | \n",
" initial | \n",
" fb_ID | \n",
" age | \n",
" birth_year | \n",
" games | \n",
" ... | \n",
" gk_passes_length_avg | \n",
" gk_goal_kicks | \n",
" gk_pct_goal_kicks_launched | \n",
" gk_goal_kick_length_avg | \n",
" gk_crosses | \n",
" gk_crosses_stopped | \n",
" gk_crosses_stopped_pct | \n",
" gk_def_actions_outside_pen_area | \n",
" gk_def_actions_outside_pen_area_per90 | \n",
" gk_avg_distance_def_actions | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 572 | \n",
" P | \n",
" Meret | \n",
" Napoli | \n",
" Meret | \n",
" | \n",
" 529 | \n",
" 25-312 | \n",
" 1997 | \n",
" 0 | \n",
" ... | \n",
" 26.6 | \n",
" 114 | \n",
" 20.2 | \n",
" 27.1 | \n",
" 197 | \n",
" 6 | \n",
" 3.0 | \n",
" 23 | \n",
" 1.21 | \n",
" 17.2 | \n",
"
\n",
" \n",
" | 1 | \n",
" 2814 | \n",
" P | \n",
" Provedel | \n",
" Lazio | \n",
" Provedel | \n",
" | \n",
" 538 | \n",
" 28-317 | \n",
" 1994 | \n",
" 0 | \n",
" ... | \n",
" 32.5 | \n",
" 115 | \n",
" 34.8 | \n",
" 34.8 | \n",
" 256 | \n",
" 7 | \n",
" 2.7 | \n",
" 37 | \n",
" 1.96 | \n",
" 18.1 | \n",
"
\n",
" \n",
" | 2 | \n",
" 4964 | \n",
" P | \n",
" Vicario | \n",
" Empoli | \n",
" Vicario | \n",
" | \n",
" 547 | \n",
" 26-113 | \n",
" 1996 | \n",
" 0 | \n",
" ... | \n",
" 33.9 | \n",
" 103 | \n",
" 45.6 | \n",
" 41.8 | \n",
" 399 | \n",
" 25 | \n",
" 6.3 | \n",
" 8 | \n",
" 0.42 | \n",
" 10.5 | \n",
"
\n",
" \n",
" | 3 | \n",
" 453 | \n",
" P | \n",
" Szczesny | \n",
" Juventus | \n",
" Szczesny | \n",
" | \n",
" 544 | \n",
" 32-285 | \n",
" 1990 | \n",
" 0 | \n",
" ... | \n",
" 36.1 | \n",
" 61 | \n",
" 41.0 | \n",
" 39.2 | \n",
" 155 | \n",
" 4 | \n",
" 2.6 | \n",
" 7 | \n",
" 0.56 | \n",
" 14.2 | \n",
"
\n",
" \n",
" | 4 | \n",
" 2134 | \n",
" P | \n",
" Falcone | \n",
" Lecce | \n",
" Falcone | \n",
" | \n",
" 524 | \n",
" 27-291 | \n",
" 1995 | \n",
" 0 | \n",
" ... | \n",
" 40.9 | \n",
" 156 | \n",
" 75.0 | \n",
" 51.4 | \n",
" 304 | \n",
" 13 | \n",
" 4.3 | \n",
" 20 | \n",
" 1.00 | \n",
" 12.5 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 5505 | \n",
" A | \n",
" Kaio Jorge | \n",
" Juventus | \n",
" Jorge | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 543 | \n",
" 5512 | \n",
" A | \n",
" De Luca | \n",
" Sampdoria | \n",
" Luca | \n",
" | \n",
" 128 | \n",
" 24-195 | \n",
" 1998 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 544 | \n",
" 5785 | \n",
" A | \n",
" Lazetic | \n",
" Milan | \n",
" Lazetic | \n",
" | \n",
" 258 | \n",
" 19-006 | \n",
" 2004 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 545 | \n",
" 6113 | \n",
" A | \n",
" Montevago | \n",
" Sampdoria | \n",
" Montevago | \n",
" | \n",
" 318 | \n",
" 19-316 | \n",
" 2003 | \n",
" 6 | \n",
" ... | \n",
" 0.0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
"
\n",
" \n",
" | 546 | \n",
" 6143 | \n",
" A | \n",
" Krollis | \n",
" Spezia | \n",
" Krollis | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 163 columns
\n",
"
"
],
"text/plain": [
" id r name team surname initial fb_ID age \\\n",
"0 572 P Meret Napoli Meret 529 25-312 \n",
"1 2814 P Provedel Lazio Provedel 538 28-317 \n",
"2 4964 P Vicario Empoli Vicario 547 26-113 \n",
"3 453 P Szczesny Juventus Szczesny 544 32-285 \n",
"4 2134 P Falcone Lecce Falcone 524 27-291 \n",
".. ... .. ... ... ... ... ... ... \n",
"542 5505 A Kaio Jorge Juventus Jorge -1 0 \n",
"543 5512 A De Luca Sampdoria Luca 128 24-195 \n",
"544 5785 A Lazetic Milan Lazetic 258 19-006 \n",
"545 6113 A Montevago Sampdoria Montevago 318 19-316 \n",
"546 6143 A Krollis Spezia Krollis -1 0 \n",
"\n",
" birth_year games ... gk_passes_length_avg gk_goal_kicks \\\n",
"0 1997 0 ... 26.6 114 \n",
"1 1994 0 ... 32.5 115 \n",
"2 1996 0 ... 33.9 103 \n",
"3 1990 0 ... 36.1 61 \n",
"4 1995 0 ... 40.9 156 \n",
".. ... ... ... ... ... \n",
"542 0 0 ... 0.0 0 \n",
"543 1998 1 ... 0.0 0 \n",
"544 2004 1 ... 0.0 0 \n",
"545 2003 6 ... 0.0 0 \n",
"546 0 0 ... 0.0 0 \n",
"\n",
" gk_pct_goal_kicks_launched gk_goal_kick_length_avg gk_crosses \\\n",
"0 20.2 27.1 197 \n",
"1 34.8 34.8 256 \n",
"2 45.6 41.8 399 \n",
"3 41.0 39.2 155 \n",
"4 75.0 51.4 304 \n",
".. ... ... ... \n",
"542 0.0 0.0 0 \n",
"543 0.0 0.0 0 \n",
"544 0.0 0.0 0 \n",
"545 0.0 0.0 0 \n",
"546 0.0 0.0 0 \n",
"\n",
" gk_crosses_stopped gk_crosses_stopped_pct \\\n",
"0 6 3.0 \n",
"1 7 2.7 \n",
"2 25 6.3 \n",
"3 4 2.6 \n",
"4 13 4.3 \n",
".. ... ... \n",
"542 0 0.0 \n",
"543 0 0.0 \n",
"544 0 0.0 \n",
"545 0 0.0 \n",
"546 0 0.0 \n",
"\n",
" gk_def_actions_outside_pen_area gk_def_actions_outside_pen_area_per90 \\\n",
"0 23 1.21 \n",
"1 37 1.96 \n",
"2 8 0.42 \n",
"3 7 0.56 \n",
"4 20 1.00 \n",
".. ... ... \n",
"542 0 0.00 \n",
"543 0 0.00 \n",
"544 0 0.00 \n",
"545 0 0.00 \n",
"546 0 0.00 \n",
"\n",
" gk_avg_distance_def_actions \n",
"0 17.2 \n",
"1 18.1 \n",
"2 10.5 \n",
"3 14.2 \n",
"4 12.5 \n",
".. ... \n",
"542 0.0 \n",
"543 0.0 \n",
"544 0.0 \n",
"545 0.0 \n",
"546 0.0 \n",
"\n",
"[547 rows x 163 columns]"
]
},
"execution_count": 38,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_players"
]
},
{
"cell_type": "markdown",
"id": "81a17f84",
"metadata": {},
"source": [
"Load votes database, to add data to players database (mean vote and its standard deviation)"
]
},
{
"cell_type": "code",
"execution_count": 39,
"id": "6a0e43cd",
"metadata": {},
"outputs": [],
"source": [
"import numpy as np\n",
"\n",
"votes = pd.read_excel('mid_outputs/players_votes.xlsx', index_col = 0)"
]
},
{
"cell_type": "markdown",
"id": "6c1b733a",
"metadata": {},
"source": [
"Compute the average Serie A Goal Keeper mean vote and vote std"
]
},
{
"cell_type": "code",
"execution_count": 40,
"id": "61fac91a",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"vote_avg 6.198757\n",
"vote_std 0.428693\n",
"dtype: float64\n"
]
},
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" vote_avg | \n",
" vote_std | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 6.263158 | \n",
" 0.496525 | \n",
"
\n",
" \n",
" | 1 | \n",
" 6.236842 | \n",
" 0.339055 | \n",
"
\n",
" \n",
" | 2 | \n",
" 6.473684 | \n",
" 0.379532 | \n",
"
\n",
" \n",
" | 3 | \n",
" 6.038462 | \n",
" 0.364878 | \n",
"
\n",
" \n",
" | 4 | \n",
" 6.342105 | \n",
" 0.364642 | \n",
"
\n",
" \n",
" | 5 | \n",
" 6.289474 | \n",
" 0.438772 | \n",
"
\n",
" \n",
" | 6 | \n",
" 5.973684 | \n",
" 0.443482 | \n",
"
\n",
" \n",
" | 7 | \n",
" 6.157895 | \n",
" 0.399099 | \n",
"
\n",
" \n",
" | 8 | \n",
" 6.366667 | \n",
" 0.426875 | \n",
"
\n",
" \n",
" | 9 | \n",
" 6.357143 | \n",
" 0.440315 | \n",
"
\n",
" \n",
" | 10 | \n",
" 6.136364 | \n",
" 0.308288 | \n",
"
\n",
" \n",
" | 11 | \n",
" 6.315789 | \n",
" 0.464830 | \n",
"
\n",
" \n",
" | 12 | \n",
" 6.125000 | \n",
" 0.297560 | \n",
"
\n",
" \n",
" | 13 | \n",
" 6.300000 | \n",
" 0.640312 | \n",
"
\n",
" \n",
" | 14 | \n",
" 6.263158 | \n",
" 0.522354 | \n",
"
\n",
" \n",
" | 15 | \n",
" 6.210526 | \n",
" 0.521026 | \n",
"
\n",
" \n",
" | 16 | \n",
" 5.958333 | \n",
" 0.246503 | \n",
"
\n",
" \n",
" | 17 | \n",
" 6.117647 | \n",
" 0.322190 | \n",
"
\n",
" \n",
" | 18 | \n",
" 6.176471 | \n",
" 0.418020 | \n",
"
\n",
" \n",
" | 19 | \n",
" 6.000000 | \n",
" 0.395285 | \n",
"
\n",
" \n",
" | 20 | \n",
" 6.071429 | \n",
" 0.494872 | \n",
"
\n",
" \n",
" | 21 | \n",
" 6.105263 | \n",
" 0.475144 | \n",
"
\n",
" \n",
" | 22 | \n",
" 6.428571 | \n",
" 0.562429 | \n",
"
\n",
" \n",
" | 23 | \n",
" 6.062500 | \n",
" 0.526634 | \n",
"
\n",
" \n",
"
\n",
"
"
],
"text/plain": [
" vote_avg vote_std\n",
"0 6.263158 0.496525\n",
"1 6.236842 0.339055\n",
"2 6.473684 0.379532\n",
"3 6.038462 0.364878\n",
"4 6.342105 0.364642\n",
"5 6.289474 0.438772\n",
"6 5.973684 0.443482\n",
"7 6.157895 0.399099\n",
"8 6.366667 0.426875\n",
"9 6.357143 0.440315\n",
"10 6.136364 0.308288\n",
"11 6.315789 0.464830\n",
"12 6.125000 0.297560\n",
"13 6.300000 0.640312\n",
"14 6.263158 0.522354\n",
"15 6.210526 0.521026\n",
"16 5.958333 0.246503\n",
"17 6.117647 0.322190\n",
"18 6.176471 0.418020\n",
"19 6.000000 0.395285\n",
"20 6.071429 0.494872\n",
"21 6.105263 0.475144\n",
"22 6.428571 0.562429\n",
"23 6.062500 0.526634"
]
},
"execution_count": 40,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"min_votes = 6\n",
"\n",
"perf_df_P = pd.DataFrame(columns = ['vote_avg', 'vote_std'])\n",
"\n",
"for i in range(fc_players.shape[0]): \n",
" if(fc_players.loc[i]['r'] == 'P'):\n",
" v = np.array([])\n",
" for j in range(votes.shape[0]):\n",
" if(fc_players['name'][i] == votes['player'][j]):\n",
" v = np.append(v, votes['vote'][j])\n",
"\n",
" if(v.shape[0] >= min_votes - 1):\n",
" row_df = pd.DataFrame(data = [[np.mean(v), np.std(v)]], columns = perf_df_P.columns)\n",
" perf_df_P = pd.concat([perf_df_P, row_df], ignore_index = True)\n",
"\n",
"\n",
"print(perf_df_P.mean())\n",
"\n",
"perf_df_P\n"
]
},
{
"cell_type": "markdown",
"id": "dbb344e2",
"metadata": {},
"source": [
"Add to players data their mean vote (and its standard deviation).\n",
"\n",
"For players who don't have a minimum amount of games, more data to reach this value is computed, according to the average Serie A player vote (and std). For goalkeepers, this values are different.\n"
]
},
{
"cell_type": "code",
"execution_count": 41,
"id": "c9312080",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" vote_avg | \n",
" vote_std | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 6.263158 | \n",
" 0.496525 | \n",
"
\n",
" \n",
" | 1 | \n",
" 6.236842 | \n",
" 0.339055 | \n",
"
\n",
" \n",
" | 2 | \n",
" 6.473684 | \n",
" 0.379532 | \n",
"
\n",
" \n",
" | 3 | \n",
" 6.038462 | \n",
" 0.364878 | \n",
"
\n",
" \n",
" | 4 | \n",
" 6.342105 | \n",
" 0.364642 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 6.092280 | \n",
" 0.894197 | \n",
"
\n",
" \n",
" | 543 | \n",
" 6.284927 | \n",
" 0.532298 | \n",
"
\n",
" \n",
" | 544 | \n",
" 6.094004 | \n",
" 0.625570 | \n",
"
\n",
" \n",
" | 545 | \n",
" 5.711934 | \n",
" 0.225193 | \n",
"
\n",
" \n",
" | 546 | \n",
" 5.748895 | \n",
" 0.595450 | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 2 columns
\n",
"
"
],
"text/plain": [
" vote_avg vote_std\n",
"0 6.263158 0.496525\n",
"1 6.236842 0.339055\n",
"2 6.473684 0.379532\n",
"3 6.038462 0.364878\n",
"4 6.342105 0.364642\n",
".. ... ...\n",
"542 6.092280 0.894197\n",
"543 6.284927 0.532298\n",
"544 6.094004 0.625570\n",
"545 5.711934 0.225193\n",
"546 5.748895 0.595450\n",
"\n",
"[547 rows x 2 columns]"
]
},
"execution_count": 41,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"min_votes = 6\n",
"\n",
"#outfield players\n",
"mean_def = 6\n",
"std_def = 0.58\n",
"\n",
"#goalkeepers\n",
"mean_def_P = 6.22\n",
"std_def_P = 0.43\n",
"\n",
"\n",
"perf_df = pd.DataFrame(columns = ['vote_avg', 'vote_std'])\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" v = np.array([])\n",
" for j in range(votes.shape[0]):\n",
" if(fc_players['name'][i] == votes['player'][j]):\n",
" v = np.append(v, votes['vote'][j])\n",
" \n",
" mean_def_i = mean_def\n",
" std_def_i = std_def\n",
" \n",
" if(fc_players['r'][i] == 'P'):\n",
" mean_def_i = mean_def_P\n",
" std_def_i = std_def_P\n",
" \n",
" if(v.shape[0] < min_votes):\n",
" for k in range(min_votes - v.shape[0]):\n",
" v = np.append( v, np.random.normal(mean_def_i, std_def_i) )\n",
" \n",
" row_df = pd.DataFrame(data = [[np.mean(v), np.std(v)]], columns = perf_df.columns)\n",
" perf_df = pd.concat([perf_df, row_df], ignore_index = True)\n",
" \n",
"perf_df\n",
" "
]
},
{
"cell_type": "code",
"execution_count": 42,
"id": "b2570ce5",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" id | \n",
" r | \n",
" name | \n",
" team | \n",
" surname | \n",
" initial | \n",
" fb_ID | \n",
" age | \n",
" birth_year | \n",
" games | \n",
" ... | \n",
" gk_pct_goal_kicks_launched | \n",
" gk_goal_kick_length_avg | \n",
" gk_crosses | \n",
" gk_crosses_stopped | \n",
" gk_crosses_stopped_pct | \n",
" gk_def_actions_outside_pen_area | \n",
" gk_def_actions_outside_pen_area_per90 | \n",
" gk_avg_distance_def_actions | \n",
" vote_avg | \n",
" vote_std | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 572 | \n",
" P | \n",
" Meret | \n",
" Napoli | \n",
" Meret | \n",
" | \n",
" 529 | \n",
" 25-312 | \n",
" 1997 | \n",
" 0 | \n",
" ... | \n",
" 20.2 | \n",
" 27.1 | \n",
" 197 | \n",
" 6 | \n",
" 3.0 | \n",
" 23 | \n",
" 1.21 | \n",
" 17.2 | \n",
" 6.263158 | \n",
" 0.496525 | \n",
"
\n",
" \n",
" | 1 | \n",
" 2814 | \n",
" P | \n",
" Provedel | \n",
" Lazio | \n",
" Provedel | \n",
" | \n",
" 538 | \n",
" 28-317 | \n",
" 1994 | \n",
" 0 | \n",
" ... | \n",
" 34.8 | \n",
" 34.8 | \n",
" 256 | \n",
" 7 | \n",
" 2.7 | \n",
" 37 | \n",
" 1.96 | \n",
" 18.1 | \n",
" 6.236842 | \n",
" 0.339055 | \n",
"
\n",
" \n",
" | 2 | \n",
" 4964 | \n",
" P | \n",
" Vicario | \n",
" Empoli | \n",
" Vicario | \n",
" | \n",
" 547 | \n",
" 26-113 | \n",
" 1996 | \n",
" 0 | \n",
" ... | \n",
" 45.6 | \n",
" 41.8 | \n",
" 399 | \n",
" 25 | \n",
" 6.3 | \n",
" 8 | \n",
" 0.42 | \n",
" 10.5 | \n",
" 6.473684 | \n",
" 0.379532 | \n",
"
\n",
" \n",
" | 3 | \n",
" 453 | \n",
" P | \n",
" Szczesny | \n",
" Juventus | \n",
" Szczesny | \n",
" | \n",
" 544 | \n",
" 32-285 | \n",
" 1990 | \n",
" 0 | \n",
" ... | \n",
" 41.0 | \n",
" 39.2 | \n",
" 155 | \n",
" 4 | \n",
" 2.6 | \n",
" 7 | \n",
" 0.56 | \n",
" 14.2 | \n",
" 6.038462 | \n",
" 0.364878 | \n",
"
\n",
" \n",
" | 4 | \n",
" 2134 | \n",
" P | \n",
" Falcone | \n",
" Lecce | \n",
" Falcone | \n",
" | \n",
" 524 | \n",
" 27-291 | \n",
" 1995 | \n",
" 0 | \n",
" ... | \n",
" 75.0 | \n",
" 51.4 | \n",
" 304 | \n",
" 13 | \n",
" 4.3 | \n",
" 20 | \n",
" 1.00 | \n",
" 12.5 | \n",
" 6.342105 | \n",
" 0.364642 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 5505 | \n",
" A | \n",
" Kaio Jorge | \n",
" Juventus | \n",
" Jorge | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.092280 | \n",
" 0.894197 | \n",
"
\n",
" \n",
" | 543 | \n",
" 5512 | \n",
" A | \n",
" De Luca | \n",
" Sampdoria | \n",
" Luca | \n",
" | \n",
" 128 | \n",
" 24-195 | \n",
" 1998 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.284927 | \n",
" 0.532298 | \n",
"
\n",
" \n",
" | 544 | \n",
" 5785 | \n",
" A | \n",
" Lazetic | \n",
" Milan | \n",
" Lazetic | \n",
" | \n",
" 258 | \n",
" 19-006 | \n",
" 2004 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.094004 | \n",
" 0.625570 | \n",
"
\n",
" \n",
" | 545 | \n",
" 6113 | \n",
" A | \n",
" Montevago | \n",
" Sampdoria | \n",
" Montevago | \n",
" | \n",
" 318 | \n",
" 19-316 | \n",
" 2003 | \n",
" 6 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 5.711934 | \n",
" 0.225193 | \n",
"
\n",
" \n",
" | 546 | \n",
" 6143 | \n",
" A | \n",
" Krollis | \n",
" Spezia | \n",
" Krollis | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0 | \n",
" 0.0 | \n",
" 0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 5.748895 | \n",
" 0.595450 | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 165 columns
\n",
"
"
],
"text/plain": [
" id r name team surname initial fb_ID age \\\n",
"0 572 P Meret Napoli Meret 529 25-312 \n",
"1 2814 P Provedel Lazio Provedel 538 28-317 \n",
"2 4964 P Vicario Empoli Vicario 547 26-113 \n",
"3 453 P Szczesny Juventus Szczesny 544 32-285 \n",
"4 2134 P Falcone Lecce Falcone 524 27-291 \n",
".. ... .. ... ... ... ... ... ... \n",
"542 5505 A Kaio Jorge Juventus Jorge -1 0 \n",
"543 5512 A De Luca Sampdoria Luca 128 24-195 \n",
"544 5785 A Lazetic Milan Lazetic 258 19-006 \n",
"545 6113 A Montevago Sampdoria Montevago 318 19-316 \n",
"546 6143 A Krollis Spezia Krollis -1 0 \n",
"\n",
" birth_year games ... gk_pct_goal_kicks_launched \\\n",
"0 1997 0 ... 20.2 \n",
"1 1994 0 ... 34.8 \n",
"2 1996 0 ... 45.6 \n",
"3 1990 0 ... 41.0 \n",
"4 1995 0 ... 75.0 \n",
".. ... ... ... ... \n",
"542 0 0 ... 0.0 \n",
"543 1998 1 ... 0.0 \n",
"544 2004 1 ... 0.0 \n",
"545 2003 6 ... 0.0 \n",
"546 0 0 ... 0.0 \n",
"\n",
" gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n",
"0 27.1 197 6 \n",
"1 34.8 256 7 \n",
"2 41.8 399 25 \n",
"3 39.2 155 4 \n",
"4 51.4 304 13 \n",
".. ... ... ... \n",
"542 0.0 0 0 \n",
"543 0.0 0 0 \n",
"544 0.0 0 0 \n",
"545 0.0 0 0 \n",
"546 0.0 0 0 \n",
"\n",
" gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n",
"0 3.0 23 \n",
"1 2.7 37 \n",
"2 6.3 8 \n",
"3 2.6 7 \n",
"4 4.3 20 \n",
".. ... ... \n",
"542 0.0 0 \n",
"543 0.0 0 \n",
"544 0.0 0 \n",
"545 0.0 0 \n",
"546 0.0 0 \n",
"\n",
" gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n",
"0 1.21 17.2 \n",
"1 1.96 18.1 \n",
"2 0.42 10.5 \n",
"3 0.56 14.2 \n",
"4 1.00 12.5 \n",
".. ... ... \n",
"542 0.00 0.0 \n",
"543 0.00 0.0 \n",
"544 0.00 0.0 \n",
"545 0.00 0.0 \n",
"546 0.00 0.0 \n",
"\n",
" vote_avg vote_std \n",
"0 6.263158 0.496525 \n",
"1 6.236842 0.339055 \n",
"2 6.473684 0.379532 \n",
"3 6.038462 0.364878 \n",
"4 6.342105 0.364642 \n",
".. ... ... \n",
"542 6.092280 0.894197 \n",
"543 6.284927 0.532298 \n",
"544 6.094004 0.625570 \n",
"545 5.711934 0.225193 \n",
"546 5.748895 0.595450 \n",
"\n",
"[547 rows x 165 columns]"
]
},
"execution_count": 42,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_players = pd.concat([fc_players, perf_df], axis = 1)\n",
"\n",
"fc_players"
]
},
{
"cell_type": "code",
"execution_count": 43,
"id": "f7620abe",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'gk_games'"
]
},
"execution_count": 43,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_players.columns[123]"
]
},
{
"cell_type": "markdown",
"id": "c550c370",
"metadata": {},
"source": [
"For goalkeepers who didn't play a miminum amount of games, data is weightly averaged with one of the main goalkeeper of their same team."
]
},
{
"cell_type": "code",
"execution_count": 44,
"id": "700b7a7d",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Zoet, 0.5\n",
"Gollini, 0.0\n",
"Ochoa, 0.8333333333333334\n",
"Pegolo, 0.33333333333333337\n",
"Mirante, 0.0\n",
"Sarr M., 0.0\n",
"Lamanna, 0.0\n",
"Ujkani, 0.0\n",
"Berisha, 0.0\n",
"Marchetti, 0.0\n",
"Perilli, 0.0\n",
"Padelli, 0.0\n",
"Perisan, 0.0\n",
"Bardi, 0.0\n",
"Cordaz, 0.0\n",
"Pinsoglio, 0.0\n",
"Fiorillo, 0.0\n",
"Cragno, 0.0\n",
"Sirigu, 0.0\n",
"Cerofolini, 0.0\n",
"Rossi F., 0.0\n",
"Ravaglia F., 0.0\n",
"Brancolini, 0.0\n",
"Bleve, 0.0\n",
"Berardi A., 0.0\n",
"Russo A., 0.0\n",
"Gemello, 0.0\n",
"Ravaglia, 0.0\n",
"Boer, 0.0\n",
"Adamonis, 0.0\n",
"Marfella, 0.0\n",
"Zovko, 0.16666666666666663\n",
"Piana, 0.0\n",
"Bagnolini, 0.0\n",
"Luis Maximiano, 0.16666666666666663\n",
"Svilar, 0.0\n",
"Sorrentino A., 0.0\n",
"Ciezkowski, 0.0\n",
"Chiesa M., 0.0\n",
"Saro, 0.0\n",
"Vasquez D., 0.0\n",
"Turk, 0.0\n"
]
}
],
"source": [
"min_gk_games = 6\n",
"\n",
"fc_players_newgk = fc_players.copy()\n",
"\n",
"columns_to_avg = fc_players.columns[123:] # from gk_games to end\n",
"\n",
"for i in range(fc_players.shape[0]):\n",
" if(fc_players['r'][i] == 'P'):\n",
" if(fc_players['gk_games'][i] < min_gk_games):\n",
" for j in range(fc_players.shape[0]):\n",
" if(fc_players['team'][i] == fc_players['team'][j] and fc_players['gk_games'][j] >= min_gk_games):\n",
" break\n",
" \n",
" weight = 1 - (min_gk_games - fc_players['gk_games'][i]) / min_gk_games\n",
" \n",
" fc_players_newgk.at[i, columns_to_avg] = fc_players.loc[i][columns_to_avg] * weight + (1 - weight) * fc_players.loc[j][columns_to_avg]\n",
" \n",
" print(fc_players['name'][i] + ', ' + str(weight))\n",
" \n",
" "
]
},
{
"cell_type": "code",
"execution_count": 45,
"id": "2d9eee99",
"metadata": {},
"outputs": [
{
"data": {
"text/html": [
"\n",
"\n",
"
\n",
" \n",
" \n",
" | \n",
" id | \n",
" r | \n",
" name | \n",
" team | \n",
" surname | \n",
" initial | \n",
" fb_ID | \n",
" age | \n",
" birth_year | \n",
" games | \n",
" ... | \n",
" gk_pct_goal_kicks_launched | \n",
" gk_goal_kick_length_avg | \n",
" gk_crosses | \n",
" gk_crosses_stopped | \n",
" gk_crosses_stopped_pct | \n",
" gk_def_actions_outside_pen_area | \n",
" gk_def_actions_outside_pen_area_per90 | \n",
" gk_avg_distance_def_actions | \n",
" vote_avg | \n",
" vote_std | \n",
"
\n",
" \n",
" \n",
" \n",
" | 0 | \n",
" 572 | \n",
" P | \n",
" Meret | \n",
" Napoli | \n",
" Meret | \n",
" | \n",
" 529 | \n",
" 25-312 | \n",
" 1997 | \n",
" 0 | \n",
" ... | \n",
" 20.2 | \n",
" 27.1 | \n",
" 197.0 | \n",
" 6.0 | \n",
" 3.0 | \n",
" 23.0 | \n",
" 1.21 | \n",
" 17.2 | \n",
" 6.263158 | \n",
" 0.496525 | \n",
"
\n",
" \n",
" | 1 | \n",
" 2814 | \n",
" P | \n",
" Provedel | \n",
" Lazio | \n",
" Provedel | \n",
" | \n",
" 538 | \n",
" 28-317 | \n",
" 1994 | \n",
" 0 | \n",
" ... | \n",
" 34.8 | \n",
" 34.8 | \n",
" 256.0 | \n",
" 7.0 | \n",
" 2.7 | \n",
" 37.0 | \n",
" 1.96 | \n",
" 18.1 | \n",
" 6.236842 | \n",
" 0.339055 | \n",
"
\n",
" \n",
" | 2 | \n",
" 4964 | \n",
" P | \n",
" Vicario | \n",
" Empoli | \n",
" Vicario | \n",
" | \n",
" 547 | \n",
" 26-113 | \n",
" 1996 | \n",
" 0 | \n",
" ... | \n",
" 45.6 | \n",
" 41.8 | \n",
" 399.0 | \n",
" 25.0 | \n",
" 6.3 | \n",
" 8.0 | \n",
" 0.42 | \n",
" 10.5 | \n",
" 6.473684 | \n",
" 0.379532 | \n",
"
\n",
" \n",
" | 3 | \n",
" 453 | \n",
" P | \n",
" Szczesny | \n",
" Juventus | \n",
" Szczesny | \n",
" | \n",
" 544 | \n",
" 32-285 | \n",
" 1990 | \n",
" 0 | \n",
" ... | \n",
" 41.0 | \n",
" 39.2 | \n",
" 155.0 | \n",
" 4.0 | \n",
" 2.6 | \n",
" 7.0 | \n",
" 0.56 | \n",
" 14.2 | \n",
" 6.038462 | \n",
" 0.364878 | \n",
"
\n",
" \n",
" | 4 | \n",
" 2134 | \n",
" P | \n",
" Falcone | \n",
" Lecce | \n",
" Falcone | \n",
" | \n",
" 524 | \n",
" 27-291 | \n",
" 1995 | \n",
" 0 | \n",
" ... | \n",
" 75.0 | \n",
" 51.4 | \n",
" 304.0 | \n",
" 13.0 | \n",
" 4.3 | \n",
" 20.0 | \n",
" 1.00 | \n",
" 12.5 | \n",
" 6.342105 | \n",
" 0.364642 | \n",
"
\n",
" \n",
" | ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
" ... | \n",
"
\n",
" \n",
" | 542 | \n",
" 5505 | \n",
" A | \n",
" Kaio Jorge | \n",
" Juventus | \n",
" Jorge | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.092280 | \n",
" 0.894197 | \n",
"
\n",
" \n",
" | 543 | \n",
" 5512 | \n",
" A | \n",
" De Luca | \n",
" Sampdoria | \n",
" Luca | \n",
" | \n",
" 128 | \n",
" 24-195 | \n",
" 1998 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.284927 | \n",
" 0.532298 | \n",
"
\n",
" \n",
" | 544 | \n",
" 5785 | \n",
" A | \n",
" Lazetic | \n",
" Milan | \n",
" Lazetic | \n",
" | \n",
" 258 | \n",
" 19-006 | \n",
" 2004 | \n",
" 1 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 6.094004 | \n",
" 0.625570 | \n",
"
\n",
" \n",
" | 545 | \n",
" 6113 | \n",
" A | \n",
" Montevago | \n",
" Sampdoria | \n",
" Montevago | \n",
" | \n",
" 318 | \n",
" 19-316 | \n",
" 2003 | \n",
" 6 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 5.711934 | \n",
" 0.225193 | \n",
"
\n",
" \n",
" | 546 | \n",
" 6143 | \n",
" A | \n",
" Krollis | \n",
" Spezia | \n",
" Krollis | \n",
" | \n",
" -1 | \n",
" 0 | \n",
" 0 | \n",
" 0 | \n",
" ... | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.0 | \n",
" 0.00 | \n",
" 0.0 | \n",
" 5.748895 | \n",
" 0.595450 | \n",
"
\n",
" \n",
"
\n",
"
547 rows × 165 columns
\n",
"
"
],
"text/plain": [
" id r name team surname initial fb_ID age \\\n",
"0 572 P Meret Napoli Meret 529 25-312 \n",
"1 2814 P Provedel Lazio Provedel 538 28-317 \n",
"2 4964 P Vicario Empoli Vicario 547 26-113 \n",
"3 453 P Szczesny Juventus Szczesny 544 32-285 \n",
"4 2134 P Falcone Lecce Falcone 524 27-291 \n",
".. ... .. ... ... ... ... ... ... \n",
"542 5505 A Kaio Jorge Juventus Jorge -1 0 \n",
"543 5512 A De Luca Sampdoria Luca 128 24-195 \n",
"544 5785 A Lazetic Milan Lazetic 258 19-006 \n",
"545 6113 A Montevago Sampdoria Montevago 318 19-316 \n",
"546 6143 A Krollis Spezia Krollis -1 0 \n",
"\n",
" birth_year games ... gk_pct_goal_kicks_launched \\\n",
"0 1997 0 ... 20.2 \n",
"1 1994 0 ... 34.8 \n",
"2 1996 0 ... 45.6 \n",
"3 1990 0 ... 41.0 \n",
"4 1995 0 ... 75.0 \n",
".. ... ... ... ... \n",
"542 0 0 ... 0.0 \n",
"543 1998 1 ... 0.0 \n",
"544 2004 1 ... 0.0 \n",
"545 2003 6 ... 0.0 \n",
"546 0 0 ... 0.0 \n",
"\n",
" gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n",
"0 27.1 197.0 6.0 \n",
"1 34.8 256.0 7.0 \n",
"2 41.8 399.0 25.0 \n",
"3 39.2 155.0 4.0 \n",
"4 51.4 304.0 13.0 \n",
".. ... ... ... \n",
"542 0.0 0.0 0.0 \n",
"543 0.0 0.0 0.0 \n",
"544 0.0 0.0 0.0 \n",
"545 0.0 0.0 0.0 \n",
"546 0.0 0.0 0.0 \n",
"\n",
" gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n",
"0 3.0 23.0 \n",
"1 2.7 37.0 \n",
"2 6.3 8.0 \n",
"3 2.6 7.0 \n",
"4 4.3 20.0 \n",
".. ... ... \n",
"542 0.0 0.0 \n",
"543 0.0 0.0 \n",
"544 0.0 0.0 \n",
"545 0.0 0.0 \n",
"546 0.0 0.0 \n",
"\n",
" gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n",
"0 1.21 17.2 \n",
"1 1.96 18.1 \n",
"2 0.42 10.5 \n",
"3 0.56 14.2 \n",
"4 1.00 12.5 \n",
".. ... ... \n",
"542 0.00 0.0 \n",
"543 0.00 0.0 \n",
"544 0.00 0.0 \n",
"545 0.00 0.0 \n",
"546 0.00 0.0 \n",
"\n",
" vote_avg vote_std \n",
"0 6.263158 0.496525 \n",
"1 6.236842 0.339055 \n",
"2 6.473684 0.379532 \n",
"3 6.038462 0.364878 \n",
"4 6.342105 0.364642 \n",
".. ... ... \n",
"542 6.092280 0.894197 \n",
"543 6.284927 0.532298 \n",
"544 6.094004 0.625570 \n",
"545 5.711934 0.225193 \n",
"546 5.748895 0.595450 \n",
"\n",
"[547 rows x 165 columns]"
]
},
"execution_count": 45,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"fc_players = fc_players_newgk\n",
"\n",
"fc_players"
]
},
{
"cell_type": "markdown",
"id": "2b13240e",
"metadata": {},
"source": [
"Save to file."
]
},
{
"cell_type": "code",
"execution_count": 46,
"id": "8336c025",
"metadata": {},
"outputs": [],
"source": [
"fc_players.to_excel('mid_outputs/players_stats.xlsx')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f3fc9b1b",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.13"
}
},
"nbformat": 4,
"nbformat_minor": 5
}