{ "cells": [ { "cell_type": "markdown", "id": "94545a88", "metadata": {}, "source": [ "players__dataset_creation code for past seasons\n", "\n", "Select the season in season variable, and repeat the code if needed" ] }, { "cell_type": "code", "execution_count": 1, "id": "b72a3c5e", "metadata": {}, "outputs": [], "source": [ "season = '2223'" ] }, { "cell_type": "code", "execution_count": 2, "id": "7c65df92", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 6, "id": "b2d7073e", "metadata": {}, "outputs": [], "source": [ "rcsv = pd.read_csv('fbref_data/season' + season + '/outfield_players.csv') \n", "outfield_players = pd.DataFrame(rcsv)\n", "\n", "rcsv = pd.read_csv('fbref_data/season' + season + '/keepers_players.csv') \n", "keeper_players = pd.DataFrame(rcsv)" ] }, { "cell_type": "code", "execution_count": 7, "id": "667970f6", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
playerteam
0James AbankwahUdinese
1Oliver AbildgaardHellas Verona
2Tammy AbrahamRoma
3Christian AcellaCremonese
4Francesco AcerbiInter
.........
647Martin TurkSampdoria
648Samir UjkaniEmpoli
649Guglielmo VicarioEmpoli
650Jeroen ZoetSpezia
651Petar ZovkoSpezia
\n", "

652 rows × 2 columns

\n", "
" ], "text/plain": [ " player team\n", "0 James Abankwah Udinese\n", "1 Oliver Abildgaard Hellas Verona\n", "2 Tammy Abraham Roma\n", "3 Christian Acella Cremonese\n", "4 Francesco Acerbi Inter\n", ".. ... ...\n", "647 Martin Turk Sampdoria\n", "648 Samir Ujkani Empoli\n", "649 Guglielmo Vicario Empoli\n", "650 Jeroen Zoet Spezia\n", "651 Petar Zovko Spezia\n", "\n", "[652 rows x 2 columns]" ] }, "execution_count": 7, "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": 8, "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": 9, "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": 10, "id": "ffd6091c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " player surname\n", "0 James Abankwah Abankwah\n", "1 Oliver Abildgaard Abildgaard\n", "2 Tammy Abraham Abraham\n", "3 Christian Acella Acella\n", "4 Francesco Acerbi Acerbi\n", "5 Yacine Adli Adli\n", "6 Michel Aebischer Aebischer\n", "7 Felix Afena-Gyan Afena-Gyan\n", "8 Kevin Agudelo Agudelo\n", "9 Ola Aina Aina\n", "10 Emanuel Aiwum Aiwum\n", "11 Jean-Daniel Akpa-Akpro Akpa-Akpro\n", "12 Luis Alberto Alberto\n", "13 Agustín Álvarez Martínez Martinez\n", "14 Kelvin Amian Amian\n", "15 Bruno Amione Amione\n", "16 Bruno Amione Amione\n", "17 Ethan Ampadu Ampadu\n", "18 Sofyan Amrabat Amrabat\n", "19 Felipe Anderson Anderson\n", "20 Janis Antiste Antiste\n", "21 Marcos Antônio Antonio\n", "22 Valentin Antov Antov\n", "23 Marko Arnautović Arnautovic\n", "24 Tolgay Arslan Arslan\n", "25 Arthur Arthur\n", "26 Santiago Ascacíbar Ascacibar\n", "27 Kristoffer Askildsen Askildsen\n", "28 Kristjan Asllani Asllani\n", "29 Emil Audero Audero\n", "30 Tommaso Augello Augello\n", "31 Kaan Ayhan Ayhan\n", "32 Jaime Báez Baez\n", "33 Nedim Bajrami Bajrami\n", "34 Nedim Bajrami Bajrami\n", "35 Tiemoué Bakayoko Bakayoko\n", "36 Tommaso Baldanzi Baldanzi\n", "37 Fodé Ballo-Touré Ballo-Toure\n", "38 Lameck Banda Banda\n", "39 Filippo Bandinelli Bandinelli\n", "40 Antonín Barák Barak\n", "41 Antonín Barák Barak\n", "42 Andrea Barberis Barberis\n", "43 Tommaso Barbieri Barbieri\n", "44 Francesco Bardi Bardi\n", "45 Nicolò Barella Barella\n", "46 Enzo Barrenechea Barrenechea\n", "47 Musa Barrow Barrow\n", "48 Federico Baschirotto Baschirotto\n", "49 Toma Bašić Basic\n", "50 Alberto Basso Basso\n", "51 Alessandro Bastoni Bastoni\n", "52 Simone Bastoni Bastoni\n", "53 Brian Bayeye Bayeye\n", "54 Rodrigo Becão Becao\n", "55 Julius Beck Beck\n", "56 Raoul Bellanova Bellanova\n", "57 Andrea Belotti Belotti\n", "58 Marco Benassi Benassi\n", "59 Marco Benassi Benassi\n", "60 Ismaël Bennacer Bennacer\n", "61 Domenico Berardi Berardi\n", "62 Bartosz Bereszyński Bereszynski\n", "63 Bartosz Bereszyński Bereszynski\n", "64 Marco Bertini Bertini\n", "65 Beto Beto\n", "66 Matteo Bianchetti Bianchetti\n", "67 Alessandro Bianco Bianco\n", "68 Jaka Bijol Bijol\n", "69 Cristiano Biraghi Biraghi\n", "70 Samuele Birindelli Birindelli\n", "71 Kristijan Bistrović Bistrovic\n", "72 Alexis Blin Blin\n", "73 Jeremie Boga Boga\n", "74 Emil Bohinen Bohinen\n", "75 Giacomo Bonaventura Bonaventura\n", "76 Federico Bonazzoli Bonazzoli\n", "77 Warren Bondo Bondo\n", "78 Kevin Bonifazi Bonifazi\n", "79 Leonardo Bonucci Bonucci\n", "80 Erik Botheim Botheim\n", "81 Mehdi Bourabia Bourabia\n", "82 Edoardo Bove Bove\n", "83 Jayden Braaf Braaf\n", "84 Domagoj Bradarić Bradaric\n", "85 Josip Brekalo Brekalo\n", "86 Gleison Bremer Bremer\n", "87 Dylan Bronn Bronn\n", "88 Marcelo Brozović Brozovic\n", "89 Cristian Buonaiuto Buonaiuto\n", "90 Alessandro Buongiorno Buongiorno\n", "91 Leonardo Buta Buta\n", "92 Juan Cabal Cabal\n", "93 Liberato Cacace Cacace\n", "94 Davide Calabria Calabria\n", "95 Mattia Caldara Caldara\n", "96 Luca Caldirola Caldirola\n", "97 Hakan Çalhanoğlu Calhanoglu\n", "98 Mohamed Camara Camara\n", "99 Nicolò Cambiaghi Cambiaghi\n", "100 Andrea Cambiaso Cambiaso\n", "101 Matteo Cancellieri Cancellieri\n", "102 Antonio Candreva Candreva\n", "103 Gianluca Caprari Caprari\n", "104 Francesco Caputo Caputo\n", "105 Francesco Caputo Caputo\n", "106 Andrea Carboni Carboni\n", "107 Franco Carboni Carboni\n", "108 Valentin Carboni Carboni\n", "109 Carlos Carlos\n", "110 Marco Carnesecchi Carnesecchi\n", "111 Nicolò Casale Casale\n", "112 Tommaso Cassandro Cassandro\n", "113 Michele Castagnetti Castagnetti\n", "114 Gaetano Castrovilli Castrovilli\n", "115 Danilo Cataldi Cataldi\n", "116 Pietro Ceccaroni Ceccaroni\n", "117 Federico Ceccherini Ceccherini\n", "118 Assan Ceesay Ceesay\n", "119 Emil Ceide Ceide\n", "120 Zeki Çelik Celik\n", "121 Michele Cerofolini Cerofolini\n", "122 Federico Chiesa Chiesa\n", "123 Vlad Chiricheș Chiriches\n", "124 Daniel Ciofani Ciofani\n", "125 Tio Cipot Cipot\n", "126 Patrick Ciurria Ciurria\n", "127 Nicolò Cocetta Cocetta\n", "128 Omar Colley Colley\n", "129 Lorenzo Colombo Colombo\n", "130 Andrea Colpani Colpani\n", "131 Andrea Consigli Consigli\n", "132 Andrea Conti Conti\n", "133 Diego Coppola Coppola\n", "134 Alex Cordaz Cordaz\n", "135 Joaquín Correa Correa\n", "136 Alessandro Cortinovis Cortinovis\n", "137 Lassana Coulibaly Coulibaly\n", "138 Alessio Cragno Cragno\n", "139 Bryan Cristante Cristante\n", "140 Domen Črnigoj Crnigoj\n", "141 Juan Cuadrado Cuadrado\n", "142 Mickaël Cuisance Cuisance\n", "143 Marco D'Alessandro DAlessandro\n", "144 Danilo D'Ambrosio DAmbrosio\n", "145 Luca D'Andrea DAndrea\n", "146 Flavius Daniliuc Daniliuc\n", "147 Danilo Danilo\n", "148 Matteo Darmian Darmian\n", "149 Paweł Dawidowicz Dawidowicz\n", "150 Charles De Ketelaere Ketelaere\n", "151 Manuel De Luca Luca\n", "152 Tommaso De Nipoti Nipoti\n", "153 Mattia De Sciglio Sciglio\n", "154 Lorenzo De Silvestri Silvestri\n", "155 Koni De Winter Winter\n", "156 Grégoire Defrel Defrel\n", "157 Duccio Degl'Innocenti DeglInnocenti\n", "158 Merih Demiral Demiral\n", "159 Diego Demme Demme\n", "160 Fabio Depaoli Depaoli\n", "161 Fabio Depaoli Depaoli\n", "162 Kastriot Dermaku Dermaku\n", "163 Cyriel Dessers Dessers\n", "164 Sergiño Dest Dest\n", "165 Mattia Destro Destro\n", "166 Gerard Deulofeu Deulofeu\n", "167 Samuel Di Carmine Carmine\n", "168 Federico Di Francesco Francesco\n", "169 Michele Di Gregorio Gregorio\n", "170 Giovanni Di Lorenzo Lorenzo\n", "171 Ángel Di María Maria\n", "172 Boulaye Dia Dia\n", "173 Brahim Díaz Diaz\n", "174 Federico Dimarco Dimarco\n", "175 Koffi Djidji Djidji\n", "176 Berat Djimsiti Djimsiti\n", "177 Dodô Dodo\n", "178 Josh Doig Doig\n", "179 Nicolás Domínguez Dominguez\n", "180 Giulio Donati Donati\n", "181 Bartłomiej Drągowski Dragowski\n", "182 Ondrej Duda Duda\n", "183 Denzel Dumfries Dumfries\n", "184 Alfred Duncan Duncan\n", "185 Paulo Dybala Dybala\n", "186 Edin Džeko Dzeko\n", "187 Festy Ebosele Ebosele\n", "188 Enzo Ebosse Ebosse\n", "189 Tyronne Ebuehi Ebuehi\n", "190 Éderson Ederson\n", "191 Kingsley Ehizibue Ehizibue\n", "192 Albin Ekdal Ekdal\n", "193 Emmanuel Ekong Ekong\n", "194 Mikael Ellertsson Ellertsson\n", "195 Elif Elmas Elmas\n", "196 Martin Erlic Erlic\n", "197 Gonzalo Escalante Escalante\n", "198 Salvatore Esposito Esposito\n", "199 Nicolò Fagioli Fagioli\n", "200 Wladimiro Falcone Falcone\n", "201 Davide Faraoni Faraoni\n", "202 Federico Fazio Fazio\n", "203 Jacopo Fazzini Fazzini\n", "204 Lewis Ferguson Ferguson\n", "205 Alex Ferrari Ferrari\n", "206 Alex Ferrari Ferrari\n", "207 Salvador Ferrer Ferrer\n", "208 Vincenzo Fiorillo Fiorillo\n", "209 Alessandro Florenzi Florenzi\n", "210 Davide Frattesi Frattesi\n", "211 Matteo Gabbia Gabbia\n", "212 Manolo Gabbiadini Gabbiadini\n", "213 Gianluca Gaetano Gaetano\n", "214 Roberto Gagliardini Gagliardini\n", "215 Adolfo Gaich Gaich\n", "216 Pablo Galdames Millán Millan\n", "217 Antonino Gallo Gallo\n", "218 Federico Gatti Gatti\n", "219 Valentin Gendrey Gendrey\n", "220 Paolo Ghiglione Ghiglione\n", "221 Mario Gila Gila\n", "222 Gvidas Gineitis Gineitis\n", "223 Olivier Giroud Giroud\n", "224 Pierluigi Gollini Gollini\n", "225 Pierluigi Gollini Gollini\n", "226 Joan Gonzàlez Gonzalez\n", "227 Nicolás González Gonzalez\n", "228 Robin Gosens Gosens\n", "229 Alberto Grassi Grassi\n", "230 Andrew Gravillon Gravillon\n", "231 Axel Guessand Guessand\n", "232 Koray Günter Gunter\n", "233 Koray Günter Gunter\n", "234 Emmanuel Gyasi Gyasi\n", "235 Norbert Gyömbér Gyomber\n", "236 Christian Gytkjær Gytkjr\n", "237 Nicolas Haas Haas\n", "238 Samir Handanović Handanovic\n", "239 Abdou Harroui Harroui\n", "240 Hans Hateboer Hateboer\n", "241 Liam Henderson Henderson\n", "242 Jack Hendry Hendry\n", "243 Matheus Henrique Henrique\n", "244 Thomas Henry Henry\n", "245 Theo Hernández Hernandez\n", "246 Isak Hien Hien\n", "247 Morten Hjulmand Hjulmand\n", "248 Emil Holm Holm\n", "249 Martin Hongla Hongla\n", "250 Petko Hristov Hristov\n", "251 Ajdin Hrustic Hrustic\n", "252 Elseid Hysaj Hysaj\n", "253 Rasmus Højlund Hjlund\n", "254 Roger Ibanez Ibanez\n", "255 Zlatan Ibrahimović Ibrahimovic\n", "256 Antonio Iervolino Iervolino\n", "257 Igor Igor\n", "258 Jonathan Ikone Ikone\n", "259 Ivan Ilić Ilic\n", "260 Ivan Ilić Ilic\n", "261 Samuel Iling-Junior Iling-Junior\n", "262 Emirhan İlkhan Ilkhan\n", "263 Emirhan İlkhan Ilkhan\n", "264 Ciro Immobile Immobile\n", "265 Ardian Ismajli Ismajli\n", "266 Mihailo Ivanović Ivanovic\n", "267 Armando Izzo Izzo\n", "268 Mato Jajalo Jajalo\n", "269 Jesé Jese\n", "270 Juan Jesus Jesus\n", "271 Þórir Jóhann Helgason Helgason\n", "272 Luka Jović Jovic\n", "273 Hamed Junior Traorè Traore\n", "274 Yayah Kallon Kallon\n", "275 Pierre Kalulu Kalulu\n", "276 Yann Karamoh Karamoh\n", "277 Rick Karsdorp Karsdorp\n", "278 Denso Kasius Kasius\n", "279 Grigoris Kastanos Kastanos\n", "280 Moise Kean Kean\n", "281 Jakub Kiwior Kiwior\n", "282 Simon Kjær Kjr\n", "283 Teun Koopmeiners Koopmeiners\n", "284 Filip Kostić Kostic\n", "285 Christian Kouamé Kouame\n", "286 Viktor Kovalenko Kovalenko\n", "287 Julian Kristoffersen Kristoffersen\n", "288 Raimonds Krollis Krollis\n", "289 Rade Krunić Krunic\n", "290 Marash Kumbulla Kumbulla\n", "291 Khvicha Kvaratskhelia Kvaratskhelia\n", "292 Giorgos Kyriakopoulos Kyriakopoulos\n", "293 Giorgos Kyriakopoulos Kyriakopoulos\n", "294 Sam Lammers Lammers\n", "295 Sam Lammers Lammers\n", "296 Kevin Lasagna Lasagna\n", "297 Armand Lauriente Lauriente\n", "298 Valentino Lazaro Lazaro\n", "299 Marko Lazetić Lazetic\n", "300 Darko Lazović Lazovic\n", "301 Manuel Lazzari Lazzari\n", "302 Rafael Leão Leao\n", "303 Mehdi Léris Leris\n", "304 Karol Linetty Linetty\n", "305 Marcin Listkowski Listkowski\n", "306 Diego Llorente Llorente\n", "307 Stanislav Lobotka Lobotka\n", "308 Manuel Locatelli Locatelli\n", "309 Luka Lochoshvili Lochoshvili\n", "310 Ademola Lookman Lookman\n", "311 Maxime Lopez Lopez\n", "312 Matteo Lovato Lovato\n", "313 Sandi Lovrić Lovric\n", "314 Hirving Lozano Lozano\n", "315 Jhon Lucumí Lucumi\n", "316 José Luis Palomino Palomino\n", "317 Romelu Lukaku Lukaku\n", "318 Saša Lukić Lukic\n", "319 Sebastiano Luperto Luperto\n", "320 Charalambos Lykogiannis Lykogiannis\n", "321 Giulio Maggiore Maggiore\n", "322 Giangiacomo Magnani Magnani\n", "323 Mike Maignan Maignan\n", "324 Jordan Majchrzak Majchrzak\n", "325 Jean-Victor Makengo Makengo\n", "326 Lorenzo Malagrida Malagrida\n", "327 Daniel Maldini Maldini\n", "328 Youssef Maleh Maleh\n", "329 Youssef Maleh Maleh\n", "330 Ruslan Malinovskyi Malinovskyi\n", "331 Gianluca Mancini Mancini\n", "332 Rolando Mandragora Mandragora\n", "333 Federico Marchetti Marchetti\n", "334 Riccardo Marchizza Marchizza\n", "335 Gian Marco Ferrari Ferrari\n", "336 Pablo Marí Mari\n", "337 Răzvan Marin Marin\n", "338 Marlon Marlon\n", "339 Luca Marrone Marrone\n", "340 Lautaro Martínez Martinez\n", "341 Lucas Martínez Quarta Quarta\n", "342 Adam Marušić Marusic\n", "343 Adam Masina Masina\n", "344 Nemanja Matić Matic\n", "345 Luís Maximiano Maximiano\n", "346 Pasquale Mazzocchi Mazzocchi\n", "347 Weston McKennie McKennie\n", "348 Gary Medel Medel\n", "349 Soualiho Meïté Meite\n", "350 Alex Meret Meret\n", "351 Yıldırım Mert Çetin Cetin\n", "352 Junior Messias Messias\n", "353 Tommaso Milanese Milanese\n", "354 Nikola Milenković Milenkovic\n", "355 Arkadiusz Milik Milik\n", "356 Sergej Milinković-Savić Milinkovic-Savic\n", "357 Vanja Milinković-Savić Milinkovic-Savic\n", "358 Kim Min-jae Min-jae\n", "359 Aleksei Miranchuk Miranchuk\n", "360 Antonio Mirante Mirante\n", "361 Fabio Miretti Miretti\n", "362 Filippo Missori Missori\n", "363 Henrikh Mkhitaryan Mkhitaryan\n", "364 Salvatore Molina Molina\n", "365 Daniele Montevago Montevago\n", "366 Lorenzo Montipò Montipo\n", "367 Nikola Moro Moro\n", "368 Dany Mota Mota\n", "369 João Moutinho Moutinho\n", "370 Mert Müldür Muldur\n", "371 Luis Muriel Muriel\n", "372 Jeison Murillo Murillo\n", "373 Nicola Murru Murru\n", "374 Juan Musso Musso\n", "375 Joakim Mæhle Mhle\n", "376 Herculano Nabian Nabian\n", "377 Michel Ndary Adopo Adopo\n", "378 Tanguy Ndombele Ndombele\n", "379 Ilija Nestorovski Nestorovski\n", "380 Cyril Ngonge Ngonge\n", "381 Hans Nicolussi Caviglia Caviglia\n", "382 Dimitris Nikolaou Nikolaou\n", "383 Samuel Ntanda Ntanda\n", "384 Bram Nuytinck Nuytinck\n", "385 Bram Nuytinck Nuytinck\n", "386 M'Bala Nzola Nzola\n", "387 Pedro Obiang Obiang\n", "388 Guillermo Ochoa Ochoa\n", "389 Marios Oikonomou Oikonomou\n", "390 David Okereke Okereke\n", "391 Caleb Okoli Okoli\n", "392 Mathías Olivera Olivera\n", "393 André Onana Onana\n", "394 Divock Origi Origi\n", "395 Riccardo Orsolini Orsolini\n", "396 Victor Osimhen Osimhen\n", "397 Remi Oudin Oudin\n", "398 Adam Ounas Ounas\n", "399 Simone Pafundi Pafundi\n", "400 Flavio Paoletti Paoletti\n", "401 Leandro Paredes Paredes\n", "402 Fabiano Parisi Parisi\n", "403 Mario Pašalić Pasalic\n", "404 Patric Patric\n", "405 Rui Patrício Patricio\n", "406 Pedro Pedro\n", "407 Gianluca Pegolo Pegolo\n", "408 Pietro Pellegri Pellegri\n", "409 Lorenzo Pellegrini Pellegrini\n", "410 Luca Pellegrini Pellegrini\n", "411 Pepín Pepin\n", "412 Roberto Pereyra Pereyra\n", "413 Nehuén Pérez Perez\n", "414 Simone Perilli Perilli\n", "415 Mattia Perin Perin\n", "416 Samuele Perisan Perisan\n", "417 Matteo Pessina Pessina\n", "418 Andrea Petagna Petagna\n", "419 Giuseppe Pezzella Pezzella\n", "420 Krzysztof Piątek Piatek\n", "421 Roberto Piccoli Piccoli\n", "422 Roberto Piccoli Piccoli\n", "423 Charles Pickel Pickel\n", "424 Andrea Pinamonti Pinamonti\n", "425 Lorenzo Pirola Pirola\n", "426 Niccolò Pisilli Pisilli\n", "427 Marko Pjaca Pjaca\n", "428 Tommaso Pobega Pobega\n", "429 Paul Pogba Pogba\n", "430 Matteo Politano Politano\n", "431 Marin Pongračić Pongracic\n", "432 Stefan Posch Posch\n", "433 Ivan Provedel Provedel\n", "434 Ignacio Pussetto Pussetto\n", "435 Niklas Pyyhtiä Pyyhtia\n", "436 Fabio Quagliarella Quagliarella\n", "437 Giacomo Quagliata Quagliata\n", "438 Adrien Rabiot Rabiot\n", "439 Nemanja Radonjić Radonjic\n", "440 Ivan Radovanović Radovanovic\n", "441 Ionuț Radu Radu\n", "442 Ștefan Radu Radu\n", "443 Antonio Raimondo Raimondo\n", "444 Luca Ranieri Ranieri\n", "445 Andrea Ranocchia Ranocchia\n", "446 Filippo Ranocchia Ranocchia\n", "447 Giacomo Raspadori Raspadori\n", "448 Giacomo Raspadori Raspadori\n", "449 Nicola Ravaglia Ravaglia\n", "450 Ante Rebić Rebic\n", "451 Arkadiusz Reca Reca\n", "452 Panagiotis Retsos Retsos\n", "453 Franck Ribéry Ribery\n", "454 Samuele Ricci Ricci\n", "455 Tomás Rincón Rincon\n", "456 Pablo Rodríguez Rodriguez\n", "457 Ricardo Rodríguez Rodriguez\n", "458 Rogério Rogerio\n", "459 Filippo Romagna Romagna\n", "460 Alessio Romagnoli Romagnoli\n", "461 Simone Romagnoli Romagnoli\n", "462 Luka Romero Romero\n", "463 Marten de Roon Roon\n", "464 Francesco Rossi Rossi\n", "465 Nicolò Rovella Rovella\n", "466 Nicolò Rovella Rovella\n", "467 Amir Rrahmani Rrahmani\n", "468 Ruan Ruan\n", "469 Daniele Rugani Rugani\n", "470 Matteo Ruggeri Ruggeri\n", "471 Mário Rui Rui\n", "472 Alessandro Russo Russo\n", "473 Abdelhamid Sabiri Sabiri\n", "474 Alexis Saelemaekers Saelemaekers\n", "475 Jacopo Sala Sala\n", "476 Lazar Samardzic Samardzic\n", "477 Junior Sambia Sambia\n", "478 Antonio Sanabria Sanabria\n", "479 Leandro Sanca Sanca\n", "480 Alex Sandro Sandro\n", "481 Nicola Sansone Sansone\n", "482 Riccardo Saponara Saponara\n", "483 Mouhamadou Sarr Sarr\n", "484 Martin Satriano Satriano\n", "485 Giorgio Scalvini Scalvini\n", "486 Jerdy Schouten Schouten\n", "487 Perr Schuurs Schuurs\n", "488 Demba Seck Seck\n", "489 Telasco Segovia Segovia\n", "490 Jacopo Segre Segre\n", "491 Vivaldo Semedo Semedo\n", "492 Stefano Sensi Sensi\n", "493 Luigi Sepe Sepe\n", "494 Leonardo Sernicola Sernicola\n", "495 Stephan El Shaarawy Shaarawy\n", "496 Eldor Shomurodov Shomurodov\n", "497 Eldor Shomurodov Shomurodov\n", "498 Marco Silvestri Silvestri\n", "499 Giovanni Simeone Simeone\n", "500 Wilfried Singo Singo\n", "501 Salvatore Sirigu Sirigu\n", "502 Leo Skiri Østigård stigard\n", "503 Łukasz Skorupski Skorupski\n", "504 Milan Škriniar Skriniar\n", "505 Chris Smalling Smalling\n", "506 Ola Solbakken Solbakken\n", "507 Brandon Soppy Soppy\n", "508 Brandon Soppy Soppy\n", "509 Roberto Soriano Soriano\n", "510 Joaquin Sosa Sosa\n", "511 Riccardo Sottil Sottil\n", "512 Matìas Soulé Soule\n", "513 Adama Soumaoro Soumaoro\n", "514 Leonardo Spinazzola Spinazzola\n", "515 Marco Sportiello Sportiello\n", "516 Petar Stojanović Stojanovic\n", "517 Gabriel Strefezza Strefezza\n", "518 Dávid Strelec Strelec\n", "519 Isaac Success Success\n", "520 Ibrahim Sulemana Sulemana\n", "521 Mile Svilar Svilar\n", "522 Wojciech Szczęsny Szczesny\n", "523 Benjamin Tahirovic Tahirovic\n", "524 Adrien Tameze Tameze\n", "525 Ciprian Tătărușanu Tatarusanu\n", "526 Filippo Terracciano Terracciano\n", "527 Pietro Terracciano Terracciano\n", "528 Aleksa Terzić Terzic\n", "529 Florian Thauvin Thauvin\n", "530 Malick Thiaw Thiaw\n", "531 Kristian Thorstvedt Thorstvedt\n", "532 Jeremy Toljan Toljan\n", "533 Rafael Tolói Toloi\n", "534 Fikayo Tomori Tomori\n", "535 Sandro Tonali Tonali\n", "536 Lorenzo Tonelli Tonelli\n", "537 William Troost-Ekong Troost-Ekong\n", "538 Frank Tsadjout Tsadjout\n", "539 Alessandro Tuia Tuia\n", "540 Martin Turk Turk\n", "541 Destiny Udogie Udogie\n", "542 Samir Ujkani Ujkani\n", "543 Samuel Umtiti Umtiti\n", "544 Diego Valencia Valencia\n", "545 Emanuele Valeri Valeri\n", "546 Mattia Valoti Valoti\n", "547 Johan Vásquez Vasquez\n", "548 Matías Vecino Vecino\n", "549 Miguel Veloso Veloso\n", "550 Lorenzo Venuti Venuti\n", "551 Daniele Verde Verde\n", "552 Simone Verdi Verdi\n", "553 Valerio Verre Verre\n", "554 Guglielmo Vicario Vicario\n", "555 Ronaldo Vieira Vieira\n", "556 Ronaldo Vieira Vieira\n", "557 Emanuel Vignato Vignato\n", "558 Emanuel Vignato Vignato\n", "559 Samuele Vignato Vignato\n", "560 Tonny Vilhena Vilhena\n", "561 Gonzalo Villar Villar\n", "562 Matías Viña Vina\n", "563 Dušan Vlahović Vlahovic\n", "564 Nikola Vlašić Vlasic\n", "565 Joel Voelkerling Persson Persson\n", "566 Mërgim Vojvoda Vojvoda\n", "567 Cristian Volpato Volpato\n", "568 Lukáš Vorlický Vorlicky\n", "569 Aster Vranckx Vranckx\n", "570 Stefan de Vrij Vrij\n", "571 Walace Walace\n", "572 Sebastian Walukiewicz Walukiewicz\n", "573 Georginio Wijnaldum Wijnaldum\n", "574 Harry Winks Winks\n", "575 Przemysław Wiśniewski Wisniewski\n", "576 Gerard Yepes Yepes\n", "577 Mattia Zaccagni Zaccagni\n", "578 Denis Zakaria Zakaria\n", "579 Nicola Zalewski Zalewski\n", "580 Andre-Frank Zambo Anguissa Anguissa\n", "581 Luca Zanimacchia Zanimacchia\n", "582 Nicolò Zaniolo Zaniolo\n", "583 Alessandro Zanoli Zanoli\n", "584 Alessandro Zanoli Zanoli\n", "585 Mattia Zanotti Zanotti\n", "586 Duván Zapata Zapata\n", "587 Davide Zappacosta Zappacosta\n", "588 Karim Zedadka Zedadka\n", "589 Deyovaisio Zeefuik Zeefuik\n", "590 Marvin Zeegelaar Zeegelaar\n", "591 Alessio Zerbin Zerbin\n", "592 Piotr Zieliński Zielinski\n", "593 David Zima Zima\n", "594 Joshua Zirkzee Zirkzee\n", "595 Jeroen Zoet Zoet\n", "596 Nadir Zortea Zortea\n", "597 Nadir Zortea Zortea\n", "598 Petar Zovko Zovko\n", "599 Szymon Żurkowski Zurkowski\n", "600 Szymon Żurkowski Zurkowski\n", "601 Milan Đurić uric\n", "602 Filip Đuričić uricic\n", "603 Emil Audero Audero\n", "604 Francesco Bardi Bardi\n", "605 Marco Carnesecchi Carnesecchi\n", "606 Michele Cerofolini Cerofolini\n", "607 Andrea Consigli Consigli\n", "608 Alex Cordaz Cordaz\n", "609 Alessio Cragno Cragno\n", "610 Michele Di Gregorio Gregorio\n", "611 Bartłomiej Drągowski Dragowski\n", "612 Wladimiro Falcone Falcone\n", "613 Vincenzo Fiorillo Fiorillo\n", "614 Pierluigi Gollini Gollini\n", "615 Pierluigi Gollini Gollini\n", "616 Samir Handanović Handanovic\n", "617 Mike Maignan Maignan\n", "618 Federico Marchetti Marchetti\n", "619 Luís Maximiano Maximiano\n", "620 Alex Meret Meret\n", "621 Vanja Milinković-Savić Milinkovic-Savic\n", "622 Antonio Mirante Mirante\n", "623 Lorenzo Montipò Montipo\n", "624 Juan Musso Musso\n", "625 Guillermo Ochoa Ochoa\n", "626 André Onana Onana\n", "627 Rui Patrício Patricio\n", "628 Gianluca Pegolo Pegolo\n", "629 Simone Perilli Perilli\n", "630 Mattia Perin Perin\n", "631 Samuele Perisan Perisan\n", "632 Ivan Provedel Provedel\n", "633 Ionuț Radu Radu\n", "634 Nicola Ravaglia Ravaglia\n", "635 Francesco Rossi Rossi\n", "636 Alessandro Russo Russo\n", "637 Mouhamadou Sarr Sarr\n", "638 Luigi Sepe Sepe\n", "639 Marco Silvestri Silvestri\n", "640 Salvatore Sirigu Sirigu\n", "641 Łukasz Skorupski Skorupski\n", "642 Marco Sportiello Sportiello\n", "643 Mile Svilar Svilar\n", "644 Wojciech Szczęsny Szczesny\n", "645 Ciprian Tătărușanu Tatarusanu\n", "646 Pietro Terracciano Terracciano\n", "647 Martin Turk Turk\n", "648 Samir Ujkani Ujkani\n", "649 Guglielmo Vicario Vicario\n", "650 Jeroen Zoet Zoet\n", "651 Petar Zovko Zovko\n" ] } ], "source": [ "print(players[['player', 'surname']].to_string())" ] }, { "cell_type": "code", "execution_count": 11, "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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
FROMTOTEAM
0stigardOstigardNapoli
1Min-jaeKimNapoli
2HjlundHojlundAtalanta
3GytkjrGytkjaerMonza
4CarlosAugustoMonza
5MhleMaehleAtalanta
6KjrKjaerMilan
7uricicDjuricicSampdoria
8uricDjuricHellas Verona
9ArthurCabralFiorentina
10MartinezAlvarezSassuolo
\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": 11, "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" ] }, { "cell_type": "code", "execution_count": 12, "id": "f96eaaa1", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\2214747983.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\2214747983.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\2214747983.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\2214747983.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", " \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", " \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", " \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", " \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", " \n", "
idrnameteamsurnameinitial
0572PMeretNapoliMeret
12814PProvedelLazioProvedel
24964PVicarioEmpoliVicario
3453PSzczesnyJuventusSzczesny
42134PFalconeLecceFalcone
.....................
5385512ADe LucaSampdoriaLuca
5395837AVoelkerling PerssonLeccePersson
5406113AMontevagoSampdoriaMontevago
5416143AKrollisSpeziaKrollis
5426160AVivaldoUdineseVivaldo
\n", "

543 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", "538 5512 A De Luca Sampdoria Luca \n", "539 5837 A Voelkerling Persson Lecce Persson \n", "540 6113 A Montevago Sampdoria Montevago \n", "541 6143 A Krollis Spezia Krollis \n", "542 6160 A Vivaldo Udinese Vivaldo \n", "\n", "[543 rows x 6 columns]" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_data = pd.read_excel('fantacalcio/season' + season + '/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.loc[i, 'surname'] = spl[-2]\n", " fc_players.loc[i, 'initial'] = spl[-1][0]\n", " else:\n", " fc_players.loc[i, 'surname'] = spl[-1]\n", " fc_players.loc[i, 'initial'] = ''\n", " \n", "fc_players\n", "\n" ] }, { "cell_type": "code", "execution_count": 13, "id": "9c50e4b5", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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.loc[i, 'fb_ID'] = -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", " if((fc_players['r'][i] == 'P') == (j >= keepers_ID)): # check wether they're a goalkeeper for both FBREF and Fantacalcio\n", " fc_players.loc[i, 'fb_ID'] = j" ] }, { "cell_type": "code", "execution_count": 14, "id": "5a3e2771", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Lamanna\n", "Berisha\n", "Padelli\n", "Pinsoglio\n", "Ravaglia F.\n", "Brancolini\n", "Bleve\n", "Berardi A.\n", "Gemello\n", "Boer\n", "Adamonis\n", "Marfella\n", "Piana\n", "Bagnolini\n", "Sorrentino A.\n", "Ciezkowski\n", "Saro\n", "Vasquez D.\n", "Aiwu\n", "Paletta\n", "Fares\n", "Amey\n", "Guarino\n", "Machin\n", "Akpa Akpro\n", "Galdames\n", "Darboe\n", "Urbanski\n", "Trimboli\n", "Samek\n", "Degli Innocenti\n", "Faticanti\n", "Oddei\n", "Kaio Jorge\n", "Vivaldo\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": 15, "id": "3b4a36af", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
idrnameteamsurnameinitialfb_ID
0572PMeretNapoliMeret620
12814PProvedelLazioProvedel632
24964PVicarioEmpoliVicario649
3453PSzczesnyJuventusSzczesny644
42134PFalconeLecceFalcone612
........................
5385512ADe LucaSampdoriaLuca151
5395837AVoelkerling PerssonLeccePersson565
5406113AMontevagoSampdoriaMontevago365
5416143AKrollisSpeziaKrollis288
5426160AVivaldoUdineseVivaldo-1
\n", "

543 rows × 7 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID\n", "0 572 P Meret Napoli Meret 620\n", "1 2814 P Provedel Lazio Provedel 632\n", "2 4964 P Vicario Empoli Vicario 649\n", "3 453 P Szczesny Juventus Szczesny 644\n", "4 2134 P Falcone Lecce Falcone 612\n", ".. ... .. ... ... ... ... ...\n", "538 5512 A De Luca Sampdoria Luca 151\n", "539 5837 A Voelkerling Persson Lecce Persson 565\n", "540 6113 A Montevago Sampdoria Montevago 365\n", "541 6143 A Krollis Spezia Krollis 288\n", "542 6160 A Vivaldo Udinese Vivaldo -1\n", "\n", "[543 rows x 7 columns]" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players" ] }, { "cell_type": "code", "execution_count": 16, "id": "1d73a312", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\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", " fc_players.loc[i, columns_to_copy[j]] = outfield_players.loc[fc_players['fb_ID'][i], columns_to_copy[j]]\n", " " ] }, { "cell_type": "code", "execution_count": 17, "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": 17, "metadata": {}, "output_type": "execute_result" } ], "source": [ "keeper_players.columns[4:]" ] }, { "cell_type": "code", "execution_count": 18, "id": "eb9127a9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.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\\Peppe\\AppData\\Local\\Temp\\ipykernel_3484\\3175819694.py:12: 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", " if(fc_players['fb_ID'][i] - delta_k >= 0):\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]\n", " fc_players.loc[i, columns_to_copy[j]] = keeper_players.loc[fc_players['fb_ID'][i] - delta_k, columns_to_copy[j]]" ] }, { "cell_type": "code", "execution_count": 19, "id": "8f2ee8b9", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
playernationalitypositionteamagebirth_yeargk_gamesgk_games_startsgk_minutesgk_goals_against...gk_passes_length_avggk_goal_kicksgk_pct_goal_kicks_launchedgk_goal_kick_length_avggk_crossesgk_crosses_stoppedgk_crosses_stopped_pctgk_def_actions_outside_pen_areagk_def_actions_outside_pen_area_per90gk_avg_distance_def_actions
0Emil Auderoit ITAGKSampdoria25199725.025.02250.039.0...39.1200.057.044.2356.024.06.723.00.9213.9
1Francesco Bardiit ITAGKBologna3019921.01.090.00.0...35.69.044.433.410.00.00.00.00.000.0
2Marco Carnesecchiit ITAGKCremonese22200027.027.02430.047.0...41.4203.066.053.1402.029.07.229.01.0714.1
3Michele Cerofoliniit ITAGKFiorentina2319995.05.0450.03.0...33.328.042.938.129.01.03.43.00.6013.8
4Andrea Consigliit ITAGKSassuolo35198735.035.03150.055.0...33.3285.031.232.5467.028.06.028.00.8014.2
5Alex Cordazit ITAGKInter3919831.00.026.00.0...33.55.060.052.07.00.00.00.00.000.0
6Alessio Cragnoit ITAGKMonza2819941.01.090.03.0...22.66.016.733.37.00.00.02.02.0025.7
7Michele Di Gregorioit ITAGKMonza25199737.037.03330.049.0...32.2247.037.234.9541.014.02.632.00.8613.4
8Bartłomiej Drągowskipl POLGKSpezia24199734.034.02946.054.0...34.6196.058.746.5472.013.02.832.00.9814.1
9Wladimiro Falconeit ITAGKLecce27199538.038.03420.046.0...42.1282.079.153.5534.023.04.342.01.1114.1
10Vincenzo Fiorilloit ITAGKSalernitana3219901.01.090.02.0...37.95.080.056.27.01.014.30.00.006.0
11Pierluigi Golliniit ITAGKNapoli2719954.04.0360.04.0...29.631.032.332.256.02.03.64.01.0018.8
12Pierluigi Golliniit ITAGKFiorentina2719953.03.0270.02.0...32.411.063.649.324.01.04.20.00.009.3
13Samir Handanovićsi SVNGKInter38198414.014.01234.018.0...24.771.011.325.5149.02.01.310.00.7315.4
14Mike Maignanfr FRAGKMilan27199522.022.01978.021.0...29.885.032.935.1221.015.06.832.01.4617.8
15Federico Marchettiit ITAGKSpezia3919831.00.066.02.0...24.38.037.532.48.00.00.01.01.3622.0
16Luís Maximianopt PORGKLazio2319991.01.05.00.0...0.00.00.00.00.00.00.00.00.0019.0
17Alex Meretit ITAGKNapoli25199734.034.03060.024.0...26.1198.020.226.9335.011.03.339.01.1517.0
18Vanja Milinković-Savićrs SRBGKTorino25199738.038.03420.041.0...39.7286.091.370.0469.036.07.770.01.8416.2
19Antonio Miranteit ITAGKMilan3919831.00.02.00.0...27.01.00.015.00.00.00.00.00.000.0
20Lorenzo Montipòit ITAGKHellas Verona26199637.037.03330.059.0...44.3284.072.552.1496.026.05.255.01.4915.3
21Juan Mussoar ARGGKAtalanta28199424.024.02077.027.0...32.1157.062.448.6253.014.05.524.01.0415.6
22Guillermo Ochoamx MEXGKSalernitana37198520.020.01800.033.0...40.9200.066.047.3311.011.03.510.00.5012.3
23André Onanacm CMRGKInter26199624.024.02160.024.0...29.6152.030.935.4283.015.05.310.00.4212.5
24Rui Patríciopt PORGKRoma34198835.035.03150.035.0...33.6240.035.834.8402.016.04.025.00.7113.8
25Gianluca Pegoloit ITAGKSassuolo4119812.02.0180.03.0...29.716.031.328.328.02.07.10.00.009.0
26Simone Perilliit ITAGKHellas Verona2719951.01.090.00.0...57.313.0100.069.819.01.05.31.01.0012.0
27Mattia Perinit ITAGKJuventus29199211.010.0948.07.0...30.863.039.735.9154.04.02.611.01.0415.7
28Samuele Perisanit ITAGKEmpoli2419977.07.0630.09.0...32.775.034.734.3134.05.03.74.00.5711.6
29Ivan Provedelit ITAGKLazio28199438.037.03413.030.0...32.2198.033.333.2493.021.04.355.01.4516.5
30Ionuț Raduro ROUGKCremonese2519979.09.0810.019.0...37.367.050.746.3107.06.05.69.01.0014.5
31Nicola Ravagliait ITAGKSampdoria3319889.09.0810.023.0...35.699.049.537.6155.010.06.51.00.1110.5
32Francesco Rossiit ITAGKAtalanta3119911.00.04.00.0...17.31.0100.065.01.00.00.00.00.000.0
33Alessandro Russoit ITAGKSassuolo2120011.01.090.03.0...30.78.00.018.314.00.00.00.00.0010.0
34Mouhamadou Sarrsn SENGKCremonese2519972.02.0180.03.0...35.712.075.053.618.00.00.01.00.508.6
35Luigi Sepeit ITAGKSalernitana31199117.017.01530.027.0...35.9154.048.741.1222.016.07.213.00.7614.2
36Marco Silvestriit ITAGKUdinese31199138.038.03420.048.0...32.0302.033.834.1547.013.02.421.00.5512.2
37Salvatore Siriguit ITAGKFiorentina3519871.01.090.00.0...37.78.050.041.812.00.00.02.02.0026.3
38Łukasz Skorupskipl POLGKBologna31199137.037.03330.049.0...31.7278.033.533.0492.029.05.924.00.6512.9
39Marco Sportielloit ITAGKAtalanta30199215.014.01339.021.0...28.8116.066.449.7200.018.09.018.01.2115.0
40Mile Svilarrs SRBGKRoma2219993.03.0270.03.0...41.416.081.360.142.06.014.34.01.3312.1
41Wojciech Szczęsnypl POLGKJuventus32199028.028.02472.026.0...33.5153.043.138.3389.011.02.821.00.7614.7
42Ciprian Tătărușanuro ROUGKMilan36198616.016.01440.022.0...32.983.051.841.8195.09.04.613.00.8114.4
43Pietro Terraccianoit ITAGKFiorentina32199029.029.02610.038.0...33.2198.045.540.5271.012.04.455.01.9018.4
44Martin Turksi SVNGKSampdoria1820034.04.0360.09.0...35.143.086.056.360.00.00.02.00.5012.3
45Samir Ujkanixk KVXGKEmpoli3419881.00.07.01.0...18.51.00.027.01.00.00.00.00.000.0
46Guglielmo Vicarioit ITAGKEmpoli25199631.031.02783.039.0...33.8170.050.042.9606.034.05.622.00.7111.5
47Jeroen Zoetnl NEDGKSpezia3119915.04.0334.04.0...39.023.078.358.462.04.06.56.01.6114.7
48Petar Zovkoba BIHGKSpezia2020021.00.074.02.0...35.113.076.951.124.01.04.22.02.4717.0
\n", "

49 rows × 47 columns

\n", "
" ], "text/plain": [ " player nationality position team age \\\n", "0 Emil Audero it ITA GK Sampdoria 25 \n", "1 Francesco Bardi it ITA GK Bologna 30 \n", "2 Marco Carnesecchi it ITA GK Cremonese 22 \n", "3 Michele Cerofolini it ITA GK Fiorentina 23 \n", "4 Andrea Consigli it ITA GK Sassuolo 35 \n", "5 Alex Cordaz it ITA GK Inter 39 \n", "6 Alessio Cragno it ITA GK Monza 28 \n", "7 Michele Di Gregorio it ITA GK Monza 25 \n", "8 Bartłomiej Drągowski pl POL GK Spezia 24 \n", "9 Wladimiro Falcone it ITA GK Lecce 27 \n", "10 Vincenzo Fiorillo it ITA GK Salernitana 32 \n", "11 Pierluigi Gollini it ITA GK Napoli 27 \n", "12 Pierluigi Gollini it ITA GK Fiorentina 27 \n", "13 Samir Handanović si SVN GK Inter 38 \n", "14 Mike Maignan fr FRA GK Milan 27 \n", "15 Federico Marchetti it ITA GK Spezia 39 \n", "16 Luís Maximiano pt POR GK Lazio 23 \n", "17 Alex Meret it ITA GK Napoli 25 \n", "18 Vanja Milinković-Savić rs SRB GK Torino 25 \n", "19 Antonio Mirante it ITA GK Milan 39 \n", "20 Lorenzo Montipò it ITA GK Hellas Verona 26 \n", "21 Juan Musso ar ARG GK Atalanta 28 \n", "22 Guillermo Ochoa mx MEX GK Salernitana 37 \n", "23 André Onana cm CMR GK Inter 26 \n", "24 Rui Patrício pt POR GK Roma 34 \n", "25 Gianluca Pegolo it ITA GK Sassuolo 41 \n", "26 Simone Perilli it ITA GK Hellas Verona 27 \n", "27 Mattia Perin it ITA GK Juventus 29 \n", "28 Samuele Perisan it ITA GK Empoli 24 \n", "29 Ivan Provedel it ITA GK Lazio 28 \n", "30 Ionuț Radu ro ROU GK Cremonese 25 \n", "31 Nicola Ravaglia it ITA GK Sampdoria 33 \n", "32 Francesco Rossi it ITA GK Atalanta 31 \n", "33 Alessandro Russo it ITA GK Sassuolo 21 \n", "34 Mouhamadou Sarr sn SEN GK Cremonese 25 \n", "35 Luigi Sepe it ITA GK Salernitana 31 \n", "36 Marco Silvestri it ITA GK Udinese 31 \n", "37 Salvatore Sirigu it ITA GK Fiorentina 35 \n", "38 Łukasz Skorupski pl POL GK Bologna 31 \n", "39 Marco Sportiello it ITA GK Atalanta 30 \n", "40 Mile Svilar rs SRB GK Roma 22 \n", "41 Wojciech Szczęsny pl POL GK Juventus 32 \n", "42 Ciprian Tătărușanu ro ROU GK Milan 36 \n", "43 Pietro Terracciano it ITA GK Fiorentina 32 \n", "44 Martin Turk si SVN GK Sampdoria 18 \n", "45 Samir Ujkani xk KVX GK Empoli 34 \n", "46 Guglielmo Vicario it ITA GK Empoli 25 \n", "47 Jeroen Zoet nl NED GK Spezia 31 \n", "48 Petar Zovko ba BIH GK Spezia 20 \n", "\n", " birth_year gk_games gk_games_starts gk_minutes gk_goals_against ... \\\n", "0 1997 25.0 25.0 2250.0 39.0 ... \n", "1 1992 1.0 1.0 90.0 0.0 ... \n", "2 2000 27.0 27.0 2430.0 47.0 ... \n", "3 1999 5.0 5.0 450.0 3.0 ... \n", "4 1987 35.0 35.0 3150.0 55.0 ... \n", "5 1983 1.0 0.0 26.0 0.0 ... \n", "6 1994 1.0 1.0 90.0 3.0 ... \n", "7 1997 37.0 37.0 3330.0 49.0 ... \n", "8 1997 34.0 34.0 2946.0 54.0 ... \n", "9 1995 38.0 38.0 3420.0 46.0 ... \n", "10 1990 1.0 1.0 90.0 2.0 ... \n", "11 1995 4.0 4.0 360.0 4.0 ... \n", "12 1995 3.0 3.0 270.0 2.0 ... \n", "13 1984 14.0 14.0 1234.0 18.0 ... \n", "14 1995 22.0 22.0 1978.0 21.0 ... \n", "15 1983 1.0 0.0 66.0 2.0 ... \n", "16 1999 1.0 1.0 5.0 0.0 ... \n", "17 1997 34.0 34.0 3060.0 24.0 ... \n", "18 1997 38.0 38.0 3420.0 41.0 ... \n", "19 1983 1.0 0.0 2.0 0.0 ... \n", "20 1996 37.0 37.0 3330.0 59.0 ... \n", "21 1994 24.0 24.0 2077.0 27.0 ... \n", "22 1985 20.0 20.0 1800.0 33.0 ... \n", "23 1996 24.0 24.0 2160.0 24.0 ... \n", "24 1988 35.0 35.0 3150.0 35.0 ... \n", "25 1981 2.0 2.0 180.0 3.0 ... \n", "26 1995 1.0 1.0 90.0 0.0 ... \n", "27 1992 11.0 10.0 948.0 7.0 ... \n", "28 1997 7.0 7.0 630.0 9.0 ... \n", "29 1994 38.0 37.0 3413.0 30.0 ... \n", "30 1997 9.0 9.0 810.0 19.0 ... \n", "31 1988 9.0 9.0 810.0 23.0 ... \n", "32 1991 1.0 0.0 4.0 0.0 ... \n", "33 2001 1.0 1.0 90.0 3.0 ... \n", "34 1997 2.0 2.0 180.0 3.0 ... \n", "35 1991 17.0 17.0 1530.0 27.0 ... \n", "36 1991 38.0 38.0 3420.0 48.0 ... \n", "37 1987 1.0 1.0 90.0 0.0 ... \n", "38 1991 37.0 37.0 3330.0 49.0 ... \n", "39 1992 15.0 14.0 1339.0 21.0 ... \n", "40 1999 3.0 3.0 270.0 3.0 ... \n", "41 1990 28.0 28.0 2472.0 26.0 ... \n", "42 1986 16.0 16.0 1440.0 22.0 ... \n", "43 1990 29.0 29.0 2610.0 38.0 ... \n", "44 2003 4.0 4.0 360.0 9.0 ... \n", "45 1988 1.0 0.0 7.0 1.0 ... \n", "46 1996 31.0 31.0 2783.0 39.0 ... \n", "47 1991 5.0 4.0 334.0 4.0 ... \n", "48 2002 1.0 0.0 74.0 2.0 ... \n", "\n", " gk_passes_length_avg gk_goal_kicks gk_pct_goal_kicks_launched \\\n", "0 39.1 200.0 57.0 \n", "1 35.6 9.0 44.4 \n", "2 41.4 203.0 66.0 \n", "3 33.3 28.0 42.9 \n", "4 33.3 285.0 31.2 \n", "5 33.5 5.0 60.0 \n", "6 22.6 6.0 16.7 \n", "7 32.2 247.0 37.2 \n", "8 34.6 196.0 58.7 \n", "9 42.1 282.0 79.1 \n", "10 37.9 5.0 80.0 \n", "11 29.6 31.0 32.3 \n", "12 32.4 11.0 63.6 \n", "13 24.7 71.0 11.3 \n", "14 29.8 85.0 32.9 \n", "15 24.3 8.0 37.5 \n", "16 0.0 0.0 0.0 \n", "17 26.1 198.0 20.2 \n", "18 39.7 286.0 91.3 \n", "19 27.0 1.0 0.0 \n", "20 44.3 284.0 72.5 \n", "21 32.1 157.0 62.4 \n", "22 40.9 200.0 66.0 \n", "23 29.6 152.0 30.9 \n", "24 33.6 240.0 35.8 \n", "25 29.7 16.0 31.3 \n", "26 57.3 13.0 100.0 \n", "27 30.8 63.0 39.7 \n", "28 32.7 75.0 34.7 \n", "29 32.2 198.0 33.3 \n", "30 37.3 67.0 50.7 \n", "31 35.6 99.0 49.5 \n", "32 17.3 1.0 100.0 \n", "33 30.7 8.0 0.0 \n", "34 35.7 12.0 75.0 \n", "35 35.9 154.0 48.7 \n", "36 32.0 302.0 33.8 \n", "37 37.7 8.0 50.0 \n", "38 31.7 278.0 33.5 \n", "39 28.8 116.0 66.4 \n", "40 41.4 16.0 81.3 \n", "41 33.5 153.0 43.1 \n", "42 32.9 83.0 51.8 \n", "43 33.2 198.0 45.5 \n", "44 35.1 43.0 86.0 \n", "45 18.5 1.0 0.0 \n", "46 33.8 170.0 50.0 \n", "47 39.0 23.0 78.3 \n", "48 35.1 13.0 76.9 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 44.2 356.0 24.0 \n", "1 33.4 10.0 0.0 \n", "2 53.1 402.0 29.0 \n", "3 38.1 29.0 1.0 \n", "4 32.5 467.0 28.0 \n", "5 52.0 7.0 0.0 \n", "6 33.3 7.0 0.0 \n", "7 34.9 541.0 14.0 \n", "8 46.5 472.0 13.0 \n", "9 53.5 534.0 23.0 \n", "10 56.2 7.0 1.0 \n", "11 32.2 56.0 2.0 \n", "12 49.3 24.0 1.0 \n", "13 25.5 149.0 2.0 \n", "14 35.1 221.0 15.0 \n", "15 32.4 8.0 0.0 \n", "16 0.0 0.0 0.0 \n", "17 26.9 335.0 11.0 \n", "18 70.0 469.0 36.0 \n", "19 15.0 0.0 0.0 \n", "20 52.1 496.0 26.0 \n", "21 48.6 253.0 14.0 \n", "22 47.3 311.0 11.0 \n", "23 35.4 283.0 15.0 \n", "24 34.8 402.0 16.0 \n", "25 28.3 28.0 2.0 \n", "26 69.8 19.0 1.0 \n", "27 35.9 154.0 4.0 \n", "28 34.3 134.0 5.0 \n", "29 33.2 493.0 21.0 \n", "30 46.3 107.0 6.0 \n", "31 37.6 155.0 10.0 \n", "32 65.0 1.0 0.0 \n", "33 18.3 14.0 0.0 \n", "34 53.6 18.0 0.0 \n", "35 41.1 222.0 16.0 \n", "36 34.1 547.0 13.0 \n", "37 41.8 12.0 0.0 \n", "38 33.0 492.0 29.0 \n", "39 49.7 200.0 18.0 \n", "40 60.1 42.0 6.0 \n", "41 38.3 389.0 11.0 \n", "42 41.8 195.0 9.0 \n", "43 40.5 271.0 12.0 \n", "44 56.3 60.0 0.0 \n", "45 27.0 1.0 0.0 \n", "46 42.9 606.0 34.0 \n", "47 58.4 62.0 4.0 \n", "48 51.1 24.0 1.0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 6.7 23.0 \n", "1 0.0 0.0 \n", "2 7.2 29.0 \n", "3 3.4 3.0 \n", "4 6.0 28.0 \n", "5 0.0 0.0 \n", "6 0.0 2.0 \n", "7 2.6 32.0 \n", "8 2.8 32.0 \n", "9 4.3 42.0 \n", "10 14.3 0.0 \n", "11 3.6 4.0 \n", "12 4.2 0.0 \n", "13 1.3 10.0 \n", "14 6.8 32.0 \n", "15 0.0 1.0 \n", "16 0.0 0.0 \n", "17 3.3 39.0 \n", "18 7.7 70.0 \n", "19 0.0 0.0 \n", "20 5.2 55.0 \n", "21 5.5 24.0 \n", "22 3.5 10.0 \n", "23 5.3 10.0 \n", "24 4.0 25.0 \n", "25 7.1 0.0 \n", "26 5.3 1.0 \n", "27 2.6 11.0 \n", "28 3.7 4.0 \n", "29 4.3 55.0 \n", "30 5.6 9.0 \n", "31 6.5 1.0 \n", "32 0.0 0.0 \n", "33 0.0 0.0 \n", "34 0.0 1.0 \n", "35 7.2 13.0 \n", "36 2.4 21.0 \n", "37 0.0 2.0 \n", "38 5.9 24.0 \n", "39 9.0 18.0 \n", "40 14.3 4.0 \n", "41 2.8 21.0 \n", "42 4.6 13.0 \n", "43 4.4 55.0 \n", "44 0.0 2.0 \n", "45 0.0 0.0 \n", "46 5.6 22.0 \n", "47 6.5 6.0 \n", "48 4.2 2.0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \n", "0 0.92 13.9 \n", "1 0.00 0.0 \n", "2 1.07 14.1 \n", "3 0.60 13.8 \n", "4 0.80 14.2 \n", "5 0.00 0.0 \n", "6 2.00 25.7 \n", "7 0.86 13.4 \n", "8 0.98 14.1 \n", "9 1.11 14.1 \n", "10 0.00 6.0 \n", "11 1.00 18.8 \n", "12 0.00 9.3 \n", "13 0.73 15.4 \n", "14 1.46 17.8 \n", "15 1.36 22.0 \n", "16 0.00 19.0 \n", "17 1.15 17.0 \n", "18 1.84 16.2 \n", "19 0.00 0.0 \n", "20 1.49 15.3 \n", "21 1.04 15.6 \n", "22 0.50 12.3 \n", "23 0.42 12.5 \n", "24 0.71 13.8 \n", "25 0.00 9.0 \n", "26 1.00 12.0 \n", "27 1.04 15.7 \n", "28 0.57 11.6 \n", "29 1.45 16.5 \n", "30 1.00 14.5 \n", "31 0.11 10.5 \n", "32 0.00 0.0 \n", "33 0.00 10.0 \n", "34 0.50 8.6 \n", "35 0.76 14.2 \n", "36 0.55 12.2 \n", "37 2.00 26.3 \n", "38 0.65 12.9 \n", "39 1.21 15.0 \n", "40 1.33 12.1 \n", "41 0.76 14.7 \n", "42 0.81 14.4 \n", "43 1.90 18.4 \n", "44 0.50 12.3 \n", "45 0.00 0.0 \n", "46 0.71 11.5 \n", "47 1.61 14.7 \n", "48 2.47 17.0 \n", "\n", "[49 rows x 47 columns]" ] }, "execution_count": 19, "metadata": {}, "output_type": "execute_result" } ], "source": [ "keeper_players" ] }, { "cell_type": "code", "execution_count": 20, "id": "da977789", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", "
idrnameteamsurnameinitialfb_IDagebirth_yeargames...gk_passes_length_avggk_goal_kicksgk_pct_goal_kicks_launchedgk_goal_kick_length_avggk_crossesgk_crosses_stoppedgk_crosses_stopped_pctgk_def_actions_outside_pen_areagk_def_actions_outside_pen_area_per90gk_avg_distance_def_actions
0572PMeretNapoliMeret6202519970...26.119820.226.9335113.3391.1517.0
12814PProvedelLazioProvedel6322819940...32.219833.333.2493214.3551.4516.5
24964PVicarioEmpoliVicario6492519960...33.817050.042.9606345.6220.7111.5
3453PSzczesnyJuventusSzczesny6443219900...33.515343.138.3389112.8210.7614.7
42134PFalconeLecceFalcone6122719950...42.128279.153.5534234.3421.1114.1
..................................................................
5385512ADe LucaSampdoriaLuca1512419982...0.000.00.0000.000.000.0
5395837AVoelkerling PerssonLeccePersson5651920039...0.000.00.0000.000.000.0
5406113AMontevagoSampdoriaMontevago3651920036...0.000.00.0000.000.000.0
5416143AKrollisSpeziaKrollis2882020014...0.000.00.0000.000.000.0
5426160AVivaldoUdineseVivaldo-1000...0.000.00.0000.000.000.0
\n", "

543 rows × 158 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 572 P Meret Napoli Meret 620 25 \n", "1 2814 P Provedel Lazio Provedel 632 28 \n", "2 4964 P Vicario Empoli Vicario 649 25 \n", "3 453 P Szczesny Juventus Szczesny 644 32 \n", "4 2134 P Falcone Lecce Falcone 612 27 \n", ".. ... .. ... ... ... ... ... ... \n", "538 5512 A De Luca Sampdoria Luca 151 24 \n", "539 5837 A Voelkerling Persson Lecce Persson 565 19 \n", "540 6113 A Montevago Sampdoria Montevago 365 19 \n", "541 6143 A Krollis Spezia Krollis 288 20 \n", "542 6160 A Vivaldo Udinese Vivaldo -1 0 \n", "\n", " birth_year games ... gk_passes_length_avg gk_goal_kicks \\\n", "0 1997 0 ... 26.1 198 \n", "1 1994 0 ... 32.2 198 \n", "2 1996 0 ... 33.8 170 \n", "3 1990 0 ... 33.5 153 \n", "4 1995 0 ... 42.1 282 \n", ".. ... ... ... ... ... \n", "538 1998 2 ... 0.0 0 \n", "539 2003 9 ... 0.0 0 \n", "540 2003 6 ... 0.0 0 \n", "541 2001 4 ... 0.0 0 \n", "542 0 0 ... 0.0 0 \n", "\n", " gk_pct_goal_kicks_launched gk_goal_kick_length_avg gk_crosses \\\n", "0 20.2 26.9 335 \n", "1 33.3 33.2 493 \n", "2 50.0 42.9 606 \n", "3 43.1 38.3 389 \n", "4 79.1 53.5 534 \n", ".. ... ... ... \n", "538 0.0 0.0 0 \n", "539 0.0 0.0 0 \n", "540 0.0 0.0 0 \n", "541 0.0 0.0 0 \n", "542 0.0 0.0 0 \n", "\n", " gk_crosses_stopped gk_crosses_stopped_pct \\\n", "0 11 3.3 \n", "1 21 4.3 \n", "2 34 5.6 \n", "3 11 2.8 \n", "4 23 4.3 \n", ".. ... ... \n", "538 0 0.0 \n", "539 0 0.0 \n", "540 0 0.0 \n", "541 0 0.0 \n", "542 0 0.0 \n", "\n", " gk_def_actions_outside_pen_area gk_def_actions_outside_pen_area_per90 \\\n", "0 39 1.15 \n", "1 55 1.45 \n", "2 22 0.71 \n", "3 21 0.76 \n", "4 42 1.11 \n", ".. ... ... \n", "538 0 0.00 \n", "539 0 0.00 \n", "540 0 0.00 \n", "541 0 0.00 \n", "542 0 0.00 \n", "\n", " gk_avg_distance_def_actions \n", "0 17.0 \n", "1 16.5 \n", "2 11.5 \n", "3 14.7 \n", "4 14.1 \n", ".. ... \n", "538 0.0 \n", "539 0.0 \n", "540 0.0 \n", "541 0.0 \n", "542 0.0 \n", "\n", "[543 rows x 158 columns]" ] }, "execution_count": 20, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players" ] }, { "cell_type": "code", "execution_count": 21, "id": "5c502f5e", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
vote_avgvote_std
06.1764710.400043
16.2631580.409378
26.4032260.447562
36.1071430.309295
46.2500000.547122
.........
5385.8712400.394770
5396.1327480.474211
5405.7224820.229188
5416.3577310.405367
5426.0066170.274006
\n", "

543 rows × 2 columns

\n", "
" ], "text/plain": [ " vote_avg vote_std\n", "0 6.176471 0.400043\n", "1 6.263158 0.409378\n", "2 6.403226 0.447562\n", "3 6.107143 0.309295\n", "4 6.250000 0.547122\n", ".. ... ...\n", "538 5.871240 0.394770\n", "539 6.132748 0.474211\n", "540 5.722482 0.229188\n", "541 6.357731 0.405367\n", "542 6.006617 0.274006\n", "\n", "[543 rows x 2 columns]" ] }, "execution_count": 21, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import numpy as np\n", "\n", "votes = pd.read_excel('mid_outputs/season' + season + '/players_votes.xlsx', index_col = 0)\n", "\n", "mean_def = 6\n", "std_def = 0.58\n", "\n", "mean_def_P = 6.22\n", "std_def_P = 0.43\n", "\n", "\n", "min_votes = 6\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", " 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": 22, "id": "9e1bc63b", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", "
idrnameteamsurnameinitialfb_IDagebirth_yeargames...gk_pct_goal_kicks_launchedgk_goal_kick_length_avggk_crossesgk_crosses_stoppedgk_crosses_stopped_pctgk_def_actions_outside_pen_areagk_def_actions_outside_pen_area_per90gk_avg_distance_def_actionsvote_avgvote_std
0572PMeretNapoliMeret6202519970...20.226.9335113.3391.1517.06.1764710.400043
12814PProvedelLazioProvedel6322819940...33.333.2493214.3551.4516.56.2631580.409378
24964PVicarioEmpoliVicario6492519960...50.042.9606345.6220.7111.56.4032260.447562
3453PSzczesnyJuventusSzczesny6443219900...43.138.3389112.8210.7614.76.1071430.309295
42134PFalconeLecceFalcone6122719950...79.153.5534234.3421.1114.16.2500000.547122
..................................................................
5385512ADe LucaSampdoriaLuca1512419982...0.00.0000.000.000.05.8712400.394770
5395837AVoelkerling PerssonLeccePersson5651920039...0.00.0000.000.000.06.1327480.474211
5406113AMontevagoSampdoriaMontevago3651920036...0.00.0000.000.000.05.7224820.229188
5416143AKrollisSpeziaKrollis2882020014...0.00.0000.000.000.06.3577310.405367
5426160AVivaldoUdineseVivaldo-1000...0.00.0000.000.000.06.0066170.274006
\n", "

543 rows × 160 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 572 P Meret Napoli Meret 620 25 \n", "1 2814 P Provedel Lazio Provedel 632 28 \n", "2 4964 P Vicario Empoli Vicario 649 25 \n", "3 453 P Szczesny Juventus Szczesny 644 32 \n", "4 2134 P Falcone Lecce Falcone 612 27 \n", ".. ... .. ... ... ... ... ... ... \n", "538 5512 A De Luca Sampdoria Luca 151 24 \n", "539 5837 A Voelkerling Persson Lecce Persson 565 19 \n", "540 6113 A Montevago Sampdoria Montevago 365 19 \n", "541 6143 A Krollis Spezia Krollis 288 20 \n", "542 6160 A Vivaldo Udinese Vivaldo -1 0 \n", "\n", " birth_year games ... gk_pct_goal_kicks_launched \\\n", "0 1997 0 ... 20.2 \n", "1 1994 0 ... 33.3 \n", "2 1996 0 ... 50.0 \n", "3 1990 0 ... 43.1 \n", "4 1995 0 ... 79.1 \n", ".. ... ... ... ... \n", "538 1998 2 ... 0.0 \n", "539 2003 9 ... 0.0 \n", "540 2003 6 ... 0.0 \n", "541 2001 4 ... 0.0 \n", "542 0 0 ... 0.0 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 26.9 335 11 \n", "1 33.2 493 21 \n", "2 42.9 606 34 \n", "3 38.3 389 11 \n", "4 53.5 534 23 \n", ".. ... ... ... \n", "538 0.0 0 0 \n", "539 0.0 0 0 \n", "540 0.0 0 0 \n", "541 0.0 0 0 \n", "542 0.0 0 0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 3.3 39 \n", "1 4.3 55 \n", "2 5.6 22 \n", "3 2.8 21 \n", "4 4.3 42 \n", ".. ... ... \n", "538 0.0 0 \n", "539 0.0 0 \n", "540 0.0 0 \n", "541 0.0 0 \n", "542 0.0 0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n", "0 1.15 17.0 \n", "1 1.45 16.5 \n", "2 0.71 11.5 \n", "3 0.76 14.7 \n", "4 1.11 14.1 \n", ".. ... ... \n", "538 0.00 0.0 \n", "539 0.00 0.0 \n", "540 0.00 0.0 \n", "541 0.00 0.0 \n", "542 0.00 0.0 \n", "\n", " vote_avg vote_std \n", "0 6.176471 0.400043 \n", "1 6.263158 0.409378 \n", "2 6.403226 0.447562 \n", "3 6.107143 0.309295 \n", "4 6.250000 0.547122 \n", ".. ... ... \n", "538 5.871240 0.394770 \n", "539 6.132748 0.474211 \n", "540 5.722482 0.229188 \n", "541 6.357731 0.405367 \n", "542 6.006617 0.274006 \n", "\n", "[543 rows x 160 columns]" ] }, "execution_count": 22, "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": 23, "id": "494db0f4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Zoet, 0.8333333333333334\n", "Pegolo, 0.33333333333333337\n", "Gollini, 0.6666666666666667\n", "Mirante, 0.16666666666666663\n", "Sarr M., 0.33333333333333337\n", "Lamanna, 0.0\n", "Ujkani, 0.16666666666666663\n", "Berisha, 0.0\n", "Marchetti, 0.16666666666666663\n", "Perilli, 0.16666666666666663\n", "Padelli, 0.0\n", "Bardi, 0.16666666666666663\n", "Cordaz, 0.16666666666666663\n", "Pinsoglio, 0.0\n", "Fiorillo, 0.16666666666666663\n", "Cragno, 0.16666666666666663\n", "Sirigu, 0.16666666666666663\n", "Cerofolini, 0.8333333333333334\n", "Rossi F., 0.16666666666666663\n", "Ravaglia F., 0.0\n", "Brancolini, 0.0\n", "Bleve, 0.0\n", "Berardi A., 0.0\n", "Russo A., 0.16666666666666663\n", "Gemello, 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.5\n", "Sorrentino A., 0.0\n", "Ciezkowski, 0.0\n", "Saro, 0.0\n", "Vasquez D., 0.0\n", "Turk, 0.6666666666666667\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": 24, "id": "3d4eec07", "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", " \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", "
idrnameteamsurnameinitialfb_IDagebirth_yeargames...gk_pct_goal_kicks_launchedgk_goal_kick_length_avggk_crossesgk_crosses_stoppedgk_crosses_stopped_pctgk_def_actions_outside_pen_areagk_def_actions_outside_pen_area_per90gk_avg_distance_def_actionsvote_avgvote_std
0572PMeretNapoliMeret6202519970...20.226.9335.011.03.339.01.1517.06.1764710.400043
12814PProvedelLazioProvedel6322819940...33.333.2493.021.04.355.01.4516.56.2631580.409378
24964PVicarioEmpoliVicario6492519960...50.042.9606.034.05.622.00.7111.56.4032260.447562
3453PSzczesnyJuventusSzczesny6443219900...43.138.3389.011.02.821.00.7614.76.1071430.309295
42134PFalconeLecceFalcone6122719950...79.153.5534.023.04.342.01.1114.16.2500000.547122
..................................................................
5385512ADe LucaSampdoriaLuca1512419982...0.00.00.00.00.00.00.000.05.8712400.394770
5395837AVoelkerling PerssonLeccePersson5651920039...0.00.00.00.00.00.00.000.06.1327480.474211
5406113AMontevagoSampdoriaMontevago3651920036...0.00.00.00.00.00.00.000.05.7224820.229188
5416143AKrollisSpeziaKrollis2882020014...0.00.00.00.00.00.00.000.06.3577310.405367
5426160AVivaldoUdineseVivaldo-1000...0.00.00.00.00.00.00.000.06.0066170.274006
\n", "

543 rows × 160 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 572 P Meret Napoli Meret 620 25 \n", "1 2814 P Provedel Lazio Provedel 632 28 \n", "2 4964 P Vicario Empoli Vicario 649 25 \n", "3 453 P Szczesny Juventus Szczesny 644 32 \n", "4 2134 P Falcone Lecce Falcone 612 27 \n", ".. ... .. ... ... ... ... ... ... \n", "538 5512 A De Luca Sampdoria Luca 151 24 \n", "539 5837 A Voelkerling Persson Lecce Persson 565 19 \n", "540 6113 A Montevago Sampdoria Montevago 365 19 \n", "541 6143 A Krollis Spezia Krollis 288 20 \n", "542 6160 A Vivaldo Udinese Vivaldo -1 0 \n", "\n", " birth_year games ... gk_pct_goal_kicks_launched \\\n", "0 1997 0 ... 20.2 \n", "1 1994 0 ... 33.3 \n", "2 1996 0 ... 50.0 \n", "3 1990 0 ... 43.1 \n", "4 1995 0 ... 79.1 \n", ".. ... ... ... ... \n", "538 1998 2 ... 0.0 \n", "539 2003 9 ... 0.0 \n", "540 2003 6 ... 0.0 \n", "541 2001 4 ... 0.0 \n", "542 0 0 ... 0.0 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 26.9 335.0 11.0 \n", "1 33.2 493.0 21.0 \n", "2 42.9 606.0 34.0 \n", "3 38.3 389.0 11.0 \n", "4 53.5 534.0 23.0 \n", ".. ... ... ... \n", "538 0.0 0.0 0.0 \n", "539 0.0 0.0 0.0 \n", "540 0.0 0.0 0.0 \n", "541 0.0 0.0 0.0 \n", "542 0.0 0.0 0.0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 3.3 39.0 \n", "1 4.3 55.0 \n", "2 5.6 22.0 \n", "3 2.8 21.0 \n", "4 4.3 42.0 \n", ".. ... ... \n", "538 0.0 0.0 \n", "539 0.0 0.0 \n", "540 0.0 0.0 \n", "541 0.0 0.0 \n", "542 0.0 0.0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n", "0 1.15 17.0 \n", "1 1.45 16.5 \n", "2 0.71 11.5 \n", "3 0.76 14.7 \n", "4 1.11 14.1 \n", ".. ... ... \n", "538 0.00 0.0 \n", "539 0.00 0.0 \n", "540 0.00 0.0 \n", "541 0.00 0.0 \n", "542 0.00 0.0 \n", "\n", " vote_avg vote_std \n", "0 6.176471 0.400043 \n", "1 6.263158 0.409378 \n", "2 6.403226 0.447562 \n", "3 6.107143 0.309295 \n", "4 6.250000 0.547122 \n", ".. ... ... \n", "538 5.871240 0.394770 \n", "539 6.132748 0.474211 \n", "540 5.722482 0.229188 \n", "541 6.357731 0.405367 \n", "542 6.006617 0.274006 \n", "\n", "[543 rows x 160 columns]" ] }, "execution_count": 24, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players = fc_players_newgk\n", "\n", "fc_players" ] }, { "cell_type": "code", "execution_count": 25, "id": "8336c025", "metadata": {}, "outputs": [], "source": [ "fc_players.to_excel('mid_outputs/season' + season + '/players_stats.xlsx')" ] } ], "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 }