{ "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": 37, "id": "b72a3c5e", "metadata": {}, "outputs": [], "source": [ "season = '2122'" ] }, { "cell_type": "code", "execution_count": 38, "id": "7c65df92", "metadata": {}, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 39, "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": 40, "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
0Tammy AbrahamRoma
1Francesco AcerbiLazio
2Michel AebischerBologna
3Felix Afena-GyanRoma
4Kevin AgudeloSpezia
.........
676Ciprian TătărușanuMilan
677Pietro TerraccianoFiorentina
678Guglielmo VicarioEmpoli
679Jeroen ZoetSpezia
680Petar ZovkoSpezia
\n", "

681 rows × 2 columns

\n", "
" ], "text/plain": [ " player team\n", "0 Tammy Abraham Roma\n", "1 Francesco Acerbi Lazio\n", "2 Michel Aebischer Bologna\n", "3 Felix Afena-Gyan Roma\n", "4 Kevin Agudelo Spezia\n", ".. ... ...\n", "676 Ciprian Tătărușanu Milan\n", "677 Pietro Terracciano Fiorentina\n", "678 Guglielmo Vicario Empoli\n", "679 Jeroen Zoet Spezia\n", "680 Petar Zovko Spezia\n", "\n", "[681 rows x 2 columns]" ] }, "execution_count": 40, "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": 41, "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": 42, "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": 43, "id": "ffd6091c", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ " player surname\n", "0 Tammy Abraham Abraham\n", "1 Francesco Acerbi Acerbi\n", "2 Michel Aebischer Aebischer\n", "3 Felix Afena-Gyan Afena-Gyan\n", "4 Kevin Agudelo Agudelo\n", "5 Ola Aina Aina\n", "6 Marley Aké Ake\n", "7 Jean-Daniel Akpa-Akpro Akpa-Akpro\n", "8 Luis Alberto Alberto\n", "9 Giorgio Altare Altare\n", "10 Wisdom Amey Amey\n", "11 Kelvin Amian Amian\n", "12 Nadiem Amiri Amiri\n", "13 Ethan Ampadu Ampadu\n", "14 Sofyan Amrabat Amrabat\n", "15 Felipe Anderson Anderson\n", "16 Ebenezer Annan Annan\n", "17 Cristian Ansaldi Ansaldi\n", "18 Janis Antiste Antiste\n", "19 Mattia Aramu Aramu\n", "20 Marko Arnautović Arnautovic\n", "21 Tolgay Arslan Arslan\n", "22 Arthur Arthur\n", "23 Kristoffer Askildsen Askildsen\n", "24 Kristjan Asllani Asllani\n", "25 Emil Audero Audero\n", "26 Tommaso Augello Augello\n", "27 Ramzi Aya Aya\n", "28 Kaan Ayhan Ayhan\n", "29 Milan Badelj Badelj\n", "30 Nicola Bagnolini Bagnolini\n", "31 Issa Bah Bah\n", "32 Nedim Bajrami Bajrami\n", "33 Tiemoué Bakayoko Bakayoko\n", "34 Tommaso Baldanzi Baldanzi\n", "35 Keita Baldé Balde\n", "36 Fodé Ballo-Touré Ballo-Toure\n", "37 Filippo Bandinelli Bandinelli\n", "38 Mattia Bani Bani\n", "39 Antonín Barák Barak\n", "40 Francesco Bardi Bardi\n", "41 Nicolò Barella Barella\n", "42 Musa Barrow Barrow\n", "43 Daniele Baselli Baselli\n", "44 Daniele Baselli Baselli\n", "45 Toma Bašić Basic\n", "46 Alessandro Bastoni Bastoni\n", "47 Simone Bastoni Bastoni\n", "48 Rodrigo Becão Becao\n", "49 Valon Behrami Behrami\n", "50 Vid Belec Belec\n", "51 Raoul Bellanova Bellanova\n", "52 Andrea Belotti Belotti\n", "53 Marco Benassi Benassi\n", "54 Marco Benassi Benassi\n", "55 Filip Benković Benkovic\n", "56 Ismaël Bennacer Bennacer\n", "57 Rodrigo Bentancur Bentancur\n", "58 Alessandro Berardi Berardi\n", "59 Domenico Berardi Berardi\n", "60 Bartosz Bereszyński Bereszynski\n", "61 Etrit Berisha Berisha\n", "62 Federico Bernardeschi Bernardeschi\n", "63 Nicolò Bertola Bertola\n", "64 Daniel Bessa Bessa\n", "65 Beto Beto\n", "66 Luis Binks Binks\n", "67 Cristiano Biraghi Biraghi\n", "68 Davide Biraschi Biraschi\n", "69 Bjarki Bjarkason Bjarkason\n", "70 Jeremie Boga Boga\n", "71 Jeremie Boga Boga\n", "72 Luka Bogdan Bogdan\n", "73 Emil Bohinen Bohinen\n", "74 Giacomo Bonaventura Bonaventura\n", "75 Federico Bonazzoli Bonazzoli\n", "76 Kevin Bonifazi Bonifazi\n", "77 Leonardo Bonucci Bonucci\n", "78 Mehdi Bourabia Bourabia\n", "79 Edoardo Bove Bove\n", "80 Josip Brekalo Brekalo\n", "81 Gleison Bremer Bremer\n", "82 Marcelo Brozović Brozovic\n", "83 Aleksander Buksa Buksa\n", "84 Alessandro Buongiorno Buongiorno\n", "85 Gianluca Busio Busio\n", "86 Jovane Cabral Cabral\n", "87 Liberato Cacace Cacace\n", "88 Martín Cáceres Caceres\n", "89 Felipe Caicedo Caicedo\n", "90 Felipe Caicedo Caicedo\n", "91 Davide Calabria Calabria\n", "92 Riccardo Calafiori Calafiori\n", "93 Riccardo Calafiori Calafiori\n", "94 Mattia Caldara Caldara\n", "95 Hakan Çalhanoğlu Calhanoglu\n", "96 José Callejón Callejon\n", "97 Andrea Cambiaso Cambiaso\n", "98 Matteo Cancellieri Cancellieri\n", "99 Antonio Candreva Candreva\n", "100 Leonardo Capezzi Capezzi\n", "101 Gianluca Caprari Caprari\n", "102 Francesco Caputo Caputo\n", "103 Francesco Caputo Caputo\n", "104 Andrea Carboni Carboni\n", "105 Nicolò Casale Casale\n", "106 Francesco Cassata Cassata\n", "107 Samu Castillejo Castillejo\n", "108 Gaetano Castrovilli Castrovilli\n", "109 Danilo Cataldi Cataldi\n", "110 Pietro Ceccaroni Ceccaroni\n", "111 Federico Ceccherini Ceccherini\n", "112 Emil Ceide Ceide\n", "113 Luca Ceppitelli Ceppitelli\n", "114 Damir Ceter Ceter\n", "115 Julian Chabot Chabot\n", "116 Giorgio Chiellini Chiellini\n", "117 Federico Chiesa Chiesa\n", "118 Vlad Chiricheș Chiriches\n", "119 Riccardo Ciervo Ciervo\n", "120 Moustapha Cissé Cisse\n", "121 Giorgio Cittadini Cittadini\n", "122 Ebrima Colley Colley\n", "123 Omar Colley Colley\n", "124 Andrea Consigli Consigli\n", "125 Andrea Conti Conti\n", "126 Andrea Conti Conti\n", "127 Diego Coppola Coppola\n", "128 Joaquín Correa Correa\n", "129 Lassana Coulibaly Coulibaly\n", "130 Mamadou Coulibaly Coulibaly\n", "131 Alessio Cragno Cragno\n", "132 Domenico Criscito Criscito\n", "133 Bryan Cristante Cristante\n", "134 Domen Črnigoj Crnigoj\n", "135 Giovanni Crociata Crociata\n", "136 Juan Cuadrado Cuadrado\n", "137 Mickaël Cuisance Cuisance\n", "138 Patrick Cutrone Cutrone\n", "139 Danilo D'Ambrosio DAmbrosio\n", "140 Mikkel Damsgaard Damsgaard\n", "141 Danilo Danilo\n", "142 Ebrima Darboe Darboe\n", "143 Matteo Darmian Darmian\n", "144 Paweł Dawidowicz Dawidowicz\n", "145 Sebastien De Maio Maio\n", "146 Tommaso De Nipoti Nipoti\n", "147 Mattia De Sciglio Sciglio\n", "148 Lorenzo De Silvestri Silvestri\n", "149 Grégoire Defrel Defrel\n", "150 Alessandro Deiola Deiola\n", "151 Filippo Delli Carri Carri\n", "152 Merih Demiral Demiral\n", "153 Diego Demme Demme\n", "154 Fabio Depaoli Depaoli\n", "155 Fabio Depaoli Depaoli\n", "156 Mattia Destro Destro\n", "157 Gerard Deulofeu Deulofeu\n", "158 Jacopo Dezi Dezi\n", "159 Samuel Di Carmine Carmine\n", "160 Federico Di Francesco Francesco\n", "161 Giovanni Di Lorenzo Lorenzo\n", "162 Francesco Di Mariano Mariano\n", "163 Francesco Di Tacchio Tacchio\n", "164 Amadou Diawara Diawara\n", "165 Brahim Díaz Diaz\n", "166 Mitchell Dijks Dijks\n", "167 Federico Dimarco Dimarco\n", "168 Filippo Distefano Distefano\n", "169 Koffi Djidji Djidji\n", "170 Berat Djimsiti Djimsiti\n", "171 Nicolás Domínguez Dominguez\n", "172 Bartłomiej Drągowski Dragowski\n", "173 Radu Drăgușin Dragusin\n", "174 Radu Drăgușin Dragusin\n", "175 Denzel Dumfries Dumfries\n", "176 Alfred Duncan Duncan\n", "177 Paulo Dybala Dybala\n", "178 Edin Džeko Dzeko\n", "179 Tyronne Ebuehi Ebuehi\n", "180 Éderson Ederson\n", "181 Albin Ekdal Ekdal\n", "182 Caleb Ekuban Ekuban\n", "183 Elif Elmas Elmas\n", "184 Martin Erlic Erlic\n", "185 Gonzalo Escalante Escalante\n", "186 Diego Falcinelli Falcinelli\n", "187 Wladimiro Falcone Falcone\n", "188 Paolo Faragò Farago\n", "189 Davide Faraoni Faraoni\n", "190 Mohamed Fares Fares\n", "191 Diego Farias Farias\n", "192 Andrea Favilli Favilli\n", "193 Federico Fazio Fazio\n", "194 Luiz Felipe Felipe\n", "195 Alex Ferrari Ferrari\n", "196 Salvador Ferrer Ferrer\n", "197 Riccardo Fiamozzi Fiamozzi\n", "198 Luca Fiordilino Fiordilino\n", "199 Vincenzo Fiorillo Fiorillo\n", "200 Alessandro Florenzi Florenzi\n", "201 Fernando Forestieri Forestieri\n", "202 Francesco Forte Forte\n", "203 Gianluca Frabotta Frabotta\n", "204 Davide Frattesi Frattesi\n", "205 Morten Frendrup Frendrup\n", "206 Remo Freuler Freuler\n", "207 Matteo Gabbia Gabbia\n", "208 Manolo Gabbiadini Gabbiadini\n", "209 Gianluca Gaetano Gaetano\n", "210 Luca Gagliano Gagliano\n", "211 Roberto Gagliardini Gagliardini\n", "212 Riccardo Gagliolo Gagliolo\n", "213 Nicolas Galazzi Galazzi\n", "214 Pablo Galdames Millán Millan\n", "215 Luca Gemello Gemello\n", "216 Paolo Ghiglione Ghiglione\n", "217 Faouzi Ghoulam Ghoulam\n", "218 Sebastian Giovinco Giovinco\n", "219 Olivier Giroud Giroud\n", "220 Diego Godín Godin\n", "221 Edoardo Goldaniga Goldaniga\n", "222 Edoardo Goldaniga Goldaniga\n", "223 Cedric Gondo Gondo\n", "224 Nicolás González Gonzalez\n", "225 Robin Gosens Gosens\n", "226 Robin Gosens Gosens\n", "227 Alberto Grassi Grassi\n", "228 Koray Günter Gunter\n", "229 Albert Guðmundsson Gumundsson\n", "230 Emmanuel Gyasi Gyasi\n", "231 Norbert Gyömbér Gyomber\n", "232 Nicolas Haas Haas\n", "233 Samir Handanović Handanovic\n", "234 Ridgeciano Haps Haps\n", "235 Abdou Harroui Harroui\n", "236 Hans Hateboer Hateboer\n", "237 Silvan Hefti Hefti\n", "238 Liam Henderson Henderson\n", "239 Dalbert Henrique Henrique\n", "240 Matheus Henrique Henrique\n", "241 Thomas Henry Henry\n", "242 Theo Hernández Hernandez\n", "243 Hernani Hernani\n", "244 Daan Heymans Heymans\n", "245 Aaron Hickey Hickey\n", "246 Martin Hongla Hongla\n", "247 Sydney van Hooijdonk Hooijdonk\n", "248 Petko Hristov Hristov\n", "249 Elseid Hysaj Hysaj\n", "250 Roger Ibanez Ibanez\n", "251 Zlatan Ibrahimović Ibrahimovic\n", "252 Igor Igor\n", "253 Jonathan Ikone Ikone\n", "254 Ivan Ilić Ilic\n", "255 Josip Iličić Ilicic\n", "256 Ciro Immobile Immobile\n", "257 Lorenzo Insigne Insigne\n", "258 Ardian Ismajli Ismajli\n", "259 Armando Izzo Izzo\n", "260 Mato Jajalo Jajalo\n", "261 Paweł Jaroszyński Jaroszynski\n", "262 Juan Jesus Jesus\n", "263 Dennis Johnsen Johnsen\n", "264 Kaio Jorge Jorge\n", "265 Flavio Junior Bianchi Bianchi\n", "266 Hamed Junior Traorè Traore\n", "267 Nikola Kalinić Kalinic\n", "268 Yayah Kallon Kallon\n", "269 Pierre Kalulu Kalulu\n", "270 Dimitrije Kamenović Kamenovic\n", "271 Rick Karsdorp Karsdorp\n", "272 Denso Kasius Kasius\n", "273 Grigoris Kastanos Kastanos\n", "274 Moise Kean Kean\n", "275 Wajdi Kechrida Kechrida\n", "276 Dimitrios Keramitsis Keramitsis\n", "277 Franck Kessié Kessie\n", "278 Jakub Kiwior Kiwior\n", "279 Sofian Kiyine Kiyine\n", "280 Simon Kjær Kjr\n", "281 Aleksandr Kokorin Kokorin\n", "282 Aleksandar Kolarov Kolarov\n", "283 Teun Koopmeiners Koopmeiners\n", "284 Kalidou Koulibaly Koulibaly\n", "285 Christos Kourfalidis Kourfalidis\n", "286 Viktor Kovalenko Kovalenko\n", "287 Julian Kristoffersen Kristoffersen\n", "288 Rade Krunić Krunic\n", "289 Dejan Kulusevski Kulusevski\n", "290 Marash Kumbulla Kumbulla\n", "291 Giorgos Kyriakopoulos Kyriakopoulos\n", "292 Andrea La Mantia Mantia\n", "293 Sam Lammers Lammers\n", "294 Kevin Lasagna Lasagna\n", "295 Darko Lazović Lazovic\n", "296 Manuel Lazzari Lazzari\n", "297 Patrick Leal Leal\n", "298 Rafael Leão Leao\n", "299 Lucas Leiva Leiva\n", "300 Luca Lezzerini Lezzerini\n", "301 Ben Lhassine Kone Kone\n", "302 Matthijs de Ligt Ligt\n", "303 Anderson Lima Lima\n", "304 Karol Linetty Linetty\n", "305 Stanislav Lobotka Lobotka\n", "306 Manuel Locatelli Locatelli\n", "307 Maxime Lopez Lopez\n", "308 Matteo Lovato Lovato\n", "309 Matteo Lovato Lovato\n", "310 Hirving Lozano Lozano\n", "311 José Luis Palomino Palomino\n", "312 Saša Lukić Lukic\n", "313 Sebastiano Luperto Luperto\n", "314 Charalambos Lykogiannis Lykogiannis\n", "315 Niki Mäenpää Maenpaa\n", "316 Giulio Maggiore Maggiore\n", "317 Francesco Magnanelli Magnanelli\n", "318 Giangiacomo Magnani Magnani\n", "319 Giangiacomo Magnani Magnani\n", "320 Mike Maignan Maignan\n", "321 Ainsley Maitland-Niles Maitland-Niles\n", "322 Jean-Victor Makengo Makengo\n", "323 Nikola Maksimović Maksimovic\n", "324 Kévin Malcuit Malcuit\n", "325 Daniel Maldini Maldini\n", "326 Youssef Maleh Maleh\n", "327 Ruslan Malinovskyi Malinovskyi\n", "328 Rey Manaj Manaj\n", "329 Gianluca Mancini Mancini\n", "330 Leonardo Mancuso Mancuso\n", "331 Rolando Mandragora Mandragora\n", "332 Kostas Manolas Manolas\n", "333 Riccardo Marchizza Marchizza\n", "334 Gian Marco Ferrari Ferrari\n", "335 Davide Marfella Marfella\n", "336 Pablo Marí Mari\n", "337 Răzvan Marin Marin\n", "338 Lautaro Martínez Martinez\n", "339 Lucas Martínez Quarta Quarta\n", "340 Adam Marušić Marusic\n", "341 Andrea Masiello Masiello\n", "342 Aleš Matějů Mateju\n", "343 Borja Mayoral Mayoral\n", "344 Pasquale Mazzocchi Mazzocchi\n", "345 Pasquale Mazzocchi Mazzocchi\n", "346 Ibrahima Mbaye Mbaye\n", "347 Weston McKennie McKennie\n", "348 Gary Medel Medel\n", "349 Filippo Melegoni Melegoni\n", "350 Arthur Melo Melo\n", "351 Alex Meret Meret\n", "352 Yıldırım Mert Çetin Cetin\n", "353 Dries Mertens Mertens\n", "354 Junior Messias Messias\n", "355 Kingsley Michael Michael\n", "356 Valentin Mihaila Mihaila\n", "357 Mikael Mikael\n", "358 Hilmir Mikaelsson Mikaelsson\n", "359 Nikola Milenković Milenkovic\n", "360 Sergej Milinković-Savić Milinkovic-Savic\n", "361 Vanja Milinković-Savić Milinkovic-Savic\n", "362 Aleksei Miranchuk Miranchuk\n", "363 Fabio Miretti Miretti\n", "364 Henrikh Mkhitaryan Mkhitaryan\n", "365 Marco Modolo Modolo\n", "366 Nahuel Molina Molina\n", "367 Cristian Molinaro Molinaro\n", "368 Lorenzo Montipò Montipo\n", "369 Álvaro Morata Morata\n", "370 Raúl Moro Moro\n", "371 Andrei Motoc Motoc\n", "372 Lys Mousset Mousset\n", "373 Samuel Mráz Mraz\n", "374 Mert Müldür Muldur\n", "375 Luis Muriel Muriel\n", "376 Vedat Muriqi Muriqi\n", "377 Nicola Murru Murru\n", "378 Juan Musso Musso\n", "379 Joakim Mæhle Mhle\n", "380 Nahitan Nández Nandez\n", "381 Nani Nani\n", "382 Matija Nastasić Nastasic\n", "383 Ilija Nestorovski Nestorovski\n", "384 Aurélien Nguiamba Nguiamba\n", "385 Dimitris Nikolaou Nikolaou\n", "386 Jean-Pierre Nsame Nsame\n", "387 Bram Nuytinck Nuytinck\n", "388 Simeon Nwankwo Nwankwo\n", "389 M'Bala Nzola Nzola\n", "390 Adam Obert Obert\n", "391 Joel Obi Obi\n", "392 Brian Oddei Oddei\n", "393 Álvaro Odriozola Odriozola\n", "394 Stefano Okaka Okaka\n", "395 David Okereke Okereke\n", "396 Christian Oliva Oliva\n", "397 Sérgio Oliveira Oliveira\n", "398 Riccardo Orsolini Orsolini\n", "399 Victor Osimhen Osimhen\n", "400 David Ospina Ospina\n", "401 Adam Ounas Ounas\n", "402 Daniele Padelli Padelli\n", "403 Simone Pafundi Pafundi\n", "404 Martin Palumbo Palumbo\n", "405 Goran Pandev Pandev\n", "406 Ivor Pandur Pandur\n", "407 Fabiano Parisi Parisi\n", "408 Mario Pašalić Pasalic\n", "409 Patric Patric\n", "410 Rui Patrício Patricio\n", "411 Leonardo Pavoletti Pavoletti\n", "412 Pedro Pedro\n", "413 João Pedro Pedro\n", "414 Gianluca Pegolo Pegolo\n", "415 Pietro Pellegri Pellegri\n", "416 Pietro Pellegri Pellegri\n", "417 Lorenzo Pellegrini Pellegrini\n", "418 Luca Pellegrini Pellegrini\n", "419 Federico Peluso Peluso\n", "420 Gastón Pereiro Pereiro\n", "421 Dor Peretz Peretz\n", "422 Roberto Pereyra Pereyra\n", "423 Carles Pérez Perez\n", "424 Nehuén Pérez Perez\n", "425 Mattia Perin Perin\n", "426 Ivan Perišić Perisic\n", "427 Diego Perotti Perotti\n", "428 Mario Perrone Perrone\n", "429 Matteo Pessina Pessina\n", "430 Andrea Petagna Petagna\n", "431 Giuseppe Pezzella Pezzella\n", "432 Krzysztof Piątek Piatek\n", "433 Roberto Piccoli Piccoli\n", "434 Roberto Piccoli Piccoli\n", "435 Andrea Pinamonti Pinamonti\n", "436 Carlo Pinsoglio Pinsoglio\n", "437 Riccardo Pinzi Pinzi\n", "438 Marko Pjaca Pjaca\n", "439 Tommaso Pobega Pobega\n", "440 Suf Podgoreanu Podgoreanu\n", "441 Matteo Politano Politano\n", "442 Manolo Portanova Portanova\n", "443 Dennis Praet Praet\n", "444 Mateusz Praszelik Praszelik\n", "445 Ivan Provedel Provedel\n", "446 Erick Pulgar Pulgar\n", "447 Ignacio Pussetto Pussetto\n", "448 Niklas Pyyhtiä Pyyhtia\n", "449 Fabio Quagliarella Quagliarella\n", "450 Adrien Rabiot Rabiot\n", "451 Ivan Radovanović Radovanovic\n", "452 Ionuț Radu Radu\n", "453 Ștefan Radu Radu\n", "454 Boris Radunović Radunovic\n", "455 Antonio Raimondo Raimondo\n", "456 Aaron Ramsey Ramsey\n", "457 Luca Ranieri Ranieri\n", "458 Andrea Ranocchia Ranocchia\n", "459 Giacomo Raspadori Raspadori\n", "460 Nicola Ravaglia Ravaglia\n", "461 Ante Rebić Rebic\n", "462 Arkadiusz Reca Reca\n", "463 Pepe Reina Reina\n", "464 Panagiotis Retsos Retsos\n", "465 Bryan Reynolds Reynolds\n", "466 Franck Ribéry Ribery\n", "467 Samuele Ricci Ricci\n", "468 Samuele Ricci Ricci\n", "469 Tomás Rincón Rincon\n", "470 Tomás Rincón Rincon\n", "471 Ricardo Rodríguez Rodriguez\n", "472 Marko Rog Rog\n", "473 Rogério Rogerio\n", "474 Alessio Romagnoli Romagnoli\n", "475 Simone Romagnoli Romagnoli\n", "476 Luka Romero Romero\n", "477 Sergio Romero Romero\n", "478 Cristiano Ronaldo Ronaldo\n", "479 Marten de Roon Roon\n", "480 Francesco Rossi Rossi\n", "481 Nicolò Rovella Rovella\n", "482 Amir Rrahmani Rrahmani\n", "483 Ruan Ruan\n", "484 Daniele Rugani Rugani\n", "485 Matteo Ruggeri Ruggeri\n", "486 Mário Rui Rui\n", "487 Fabián Ruiz Peña Pena\n", "488 Alessandro Russo Russo\n", "489 Stefano Sabelli Sabelli\n", "490 Abdelhamid Sabiri Sabiri\n", "491 Alexis Saelemaekers Saelemaekers\n", "492 Jacopo Sala Sala\n", "493 Eddie Salcedo Salcedo\n", "494 Lazar Samardzic Samardzic\n", "495 Luigi Samele Samele\n", "496 Antonio Sanabria Sanabria\n", "497 Alexis Sánchez Sanchez\n", "498 Alex Sandro Sandro\n", "499 Nicola Sansone Sansone\n", "500 Federico Santander Santander\n", "501 Samir Santos Santos\n", "502 Riccardo Saponara Saponara\n", "503 Giacomo Satalino Satalino\n", "504 Martin Satriano Satriano\n", "505 Giorgio Scalvini Scalvini\n", "506 Gianluca Scamacca Scamacca\n", "507 Andrea Schiavone Schiavone\n", "508 David Schnegg Schnegg\n", "509 Jerdy Schouten Schouten\n", "510 Demba Seck Seck\n", "511 Adrian Šemper Semper\n", "512 Stefano Sensi Sensi\n", "513 Stefano Sensi Sensi\n", "514 Luigi Sepe Sepe\n", "515 Laurens Serpe Serpe\n", "516 Stephan El Shaarawy Shaarawy\n", "517 Aimar Sher Sher\n", "518 Eldor Shomurodov Shomurodov\n", "519 Alassane Sidibe Sidibe\n", "520 Arnór Sigurðsson Sigursson\n", "521 Adrien Silva Silva\n", "522 Marco Silvestri Silvestri\n", "523 Giovanni Simeone Simeone\n", "524 Giovanni Simeone Simeone\n", "525 Wilfried Singo Singo\n", "526 Salvatore Sirigu Sirigu\n", "527 Leo Skiri Østigård stigard\n", "528 Łukasz Skorupski Skorupski\n", "529 Andreas Skov Olsen Olsen\n", "530 Milan Škriniar Skriniar\n", "531 Chris Smalling Smalling\n", "532 Brandon Soppy Soppy\n", "533 Roberto Soriano Soriano\n", "534 Riccardo Sottil Sottil\n", "535 Matìas Soulé Soule\n", "536 Adama Soumaoro Soumaoro\n", "537 Leonardo Spinazzola Spinazzola\n", "538 Marco Sportiello Sportiello\n", "539 Luca Stanga Stanga\n", "540 Riccardo Stivanello Stivanello\n", "541 Petar Stojanović Stojanovic\n", "542 Thomas Strakosha Strakosha\n", "543 Stefan Strandberg Strandberg\n", "544 Dávid Strelec Strelec\n", "545 Kevin Strootman Strootman\n", "546 Jens Stryger Larsen Larsen\n", "547 Leo Štulac Stulac\n", "548 Stefano Sturaro Sturaro\n", "549 Isaac Success Success\n", "550 Vladyslav Supriaha Supriaha\n", "551 Bosko Sutalo Sutalo\n", "552 Mattias Svanberg Svanberg\n", "553 Michael Svoboda Svoboda\n", "554 Wojciech Szczęsny Szczesny\n", "555 Adrien Tameze Tameze\n", "556 Ciprian Tătărușanu Tatarusanu\n", "557 Filippo Terracciano Terracciano\n", "558 Pietro Terracciano Terracciano\n", "559 Aleksa Terzić Terzic\n", "560 Tanner Tessmann Tessmann\n", "561 Arthur Theate Theate\n", "562 Morten Thorsby Thorsby\n", "563 Jeremy Toljan Toljan\n", "564 Rafael Tolói Toloi\n", "565 Takehiro Tomiyasu Tomiyasu\n", "566 Fikayo Tomori Tomori\n", "567 Sandro Tonali Tonali\n", "568 Lorenzo Tonelli Tonelli\n", "569 Ernesto Torregrossa Torregrossa\n", "570 Lucas Torreira Torreira\n", "571 Abdoulaye Touré Toure\n", "572 Simone Trimboli Trimboli\n", "573 Axel Tuanzebe Tuanzebe\n", "574 Iyenoma Udogie Udogie\n", "575 Maximilian Ullmann Ullmann\n", "576 Kacper Urbanski Urbanski\n", "577 Antonio Vacca Vacca\n", "578 Zinho Vanheusden Vanheusden\n", "579 Johan Vásquez Vasquez\n", "580 Denis Vavro Vavro\n", "581 Matías Vecino Vecino\n", "582 Miguel Veloso Veloso\n", "583 Lorenzo Venuti Venuti\n", "584 Daniele Verde Verde\n", "585 Simone Verdi Verdi\n", "586 Simone Verdi Verdi\n", "587 Jordan Veretout Veretout\n", "588 Edoardo Vergani Vergani\n", "589 Valerio Verre Verre\n", "590 Valerio Verre Verre\n", "591 Freddie Veseli Veseli\n", "592 Guglielmo Vicario Vicario\n", "593 Arturo Vidal Vidal\n", "594 Ronaldo Vieira Vieira\n", "595 Luca Vignali Vignali\n", "596 Emanuel Vignato Vignato\n", "597 Matías Viña Vina\n", "598 Nicolas Viola Viola\n", "599 Mattia Viti Viti\n", "600 Dušan Vlahović Vlahovic\n", "601 Dušan Vlahović Vlahovic\n", "602 Mërgim Vojvoda Vojvoda\n", "603 Cristian Volpato Volpato\n", "604 Stefan de Vrij Vrij\n", "605 Walace Walace\n", "606 Sebastian Walukiewicz Walukiewicz\n", "607 Magnus Warming Warming\n", "608 Kelvin Yeboah Yeboah\n", "609 Gerard Yepes Yepes\n", "610 Maya Yoshida Yoshida\n", "611 Mattia Zaccagni Zaccagni\n", "612 Mattia Zaccagni Zaccagni\n", "613 Denis Zakaria Zakaria\n", "614 Nicola Zalewski Zalewski\n", "615 Andre-Frank Zambo Anguissa Anguissa\n", "616 Nicolò Zaniolo Zaniolo\n", "617 Alessandro Zanoli Zanoli\n", "618 Mattia Zanotti Zanotti\n", "619 Duván Zapata Zapata\n", "620 Gabriele Zappa Zappa\n", "621 Davide Zappacosta Zappacosta\n", "622 Simone Zaza Zaza\n", "623 Marvin Zeegelaar Zeegelaar\n", "624 Piotr Zieliński Zielinski\n", "625 David Zima Zima\n", "626 Jeroen Zoet Zoet\n", "627 Nadir Zortea Zortea\n", "628 Petar Zovko Zovko\n", "629 Szymon Żurkowski Zurkowski\n", "630 Milan Đurić uric\n", "631 Filip Đuričić uricic\n", "632 Emil Audero Audero\n", "633 Nicola Bagnolini Bagnolini\n", "634 Francesco Bardi Bardi\n", "635 Vid Belec Belec\n", "636 Alessandro Berardi Berardi\n", "637 Etrit Berisha Berisha\n", "638 Andrea Consigli Consigli\n", "639 Alessio Cragno Cragno\n", "640 Bartłomiej Drągowski Dragowski\n", "641 Wladimiro Falcone Falcone\n", "642 Vincenzo Fiorillo Fiorillo\n", "643 Luca Gemello Gemello\n", "644 Samir Handanović Handanovic\n", "645 Luca Lezzerini Lezzerini\n", "646 Niki Mäenpää Maenpaa\n", "647 Mike Maignan Maignan\n", "648 Davide Marfella Marfella\n", "649 Alex Meret Meret\n", "650 Vanja Milinković-Savić Milinkovic-Savic\n", "651 Lorenzo Montipò Montipo\n", "652 Juan Musso Musso\n", "653 David Ospina Ospina\n", "654 Daniele Padelli Padelli\n", "655 Ivor Pandur Pandur\n", "656 Rui Patrício Patricio\n", "657 Gianluca Pegolo Pegolo\n", "658 Mattia Perin Perin\n", "659 Carlo Pinsoglio Pinsoglio\n", "660 Ivan Provedel Provedel\n", "661 Ionuț Radu Radu\n", "662 Boris Radunović Radunovic\n", "663 Nicola Ravaglia Ravaglia\n", "664 Pepe Reina Reina\n", "665 Sergio Romero Romero\n", "666 Francesco Rossi Rossi\n", "667 Giacomo Satalino Satalino\n", "668 Adrian Šemper Semper\n", "669 Luigi Sepe Sepe\n", "670 Marco Silvestri Silvestri\n", "671 Salvatore Sirigu Sirigu\n", "672 Łukasz Skorupski Skorupski\n", "673 Marco Sportiello Sportiello\n", "674 Thomas Strakosha Strakosha\n", "675 Wojciech Szczęsny Szczesny\n", "676 Ciprian Tătărușanu Tatarusanu\n", "677 Pietro Terracciano Terracciano\n", "678 Guglielmo Vicario Vicario\n", "679 Jeroen Zoet Zoet\n", "680 Petar Zovko Zovko\n" ] } ], "source": [ "print(players[['player', 'surname']].to_string())" ] }, { "cell_type": "code", "execution_count": 44, "id": "3e759b1b", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Maehle\n", "Kjaer\n", "Cabral\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": 44, "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": 45, "id": "f96eaaa1", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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
04312PMaignanMilanMaignan
1453PSzczesnyJuventusSzczesny
22468POspinaNapoliOspina
3250PHandanovicInterHandanovic
4316PBerishaTorinoBerisha
.....................
5455391AKokorinFiorentinaKokorin
5465458AMunteanuFiorentinaMunteanu
5475459ABuksaGenoaBuksa
5485505AKaio JorgeJuventusJorge
5495785ALazeticMilanLazetic
\n", "

550 rows × 6 columns

\n", "
" ], "text/plain": [ " id r name team surname initial\n", "0 4312 P Maignan Milan Maignan \n", "1 453 P Szczesny Juventus Szczesny \n", "2 2468 P Ospina Napoli Ospina \n", "3 250 P Handanovic Inter Handanovic \n", "4 316 P Berisha Torino Berisha \n", ".. ... .. ... ... ... ...\n", "545 5391 A Kokorin Fiorentina Kokorin \n", "546 5458 A Munteanu Fiorentina Munteanu \n", "547 5459 A Buksa Genoa Buksa \n", "548 5505 A Kaio Jorge Juventus Jorge \n", "549 5785 A Lazetic Milan Lazetic \n", "\n", "[550 rows x 6 columns]" ] }, "execution_count": 45, "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['surname'][i] = spl[-2]\n", " fc_players['initial'][i] = spl[-1][0]\n", " else:\n", " fc_players['surname'][i] = spl[-1]\n", " fc_players['initial'][i] = ''\n", " \n", "fc_players\n", "\n" ] }, { "cell_type": "code", "execution_count": 46, "id": "9c50e4b5", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\1456862974.py:4: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " fc_players['fb_ID'][i] = -1\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\1456862974.py:10: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " fc_players['fb_ID'][i] = j\n" ] } ], "source": [ "fc_players['fb_ID'] = fc_players['id']\n", "\n", "for i in range(fc_players.shape[0]):\n", " fc_players['fb_ID'][i] = -1\n", " \n", " for j in range(players.shape[0]):\n", " if(fc_players['team'][i].lower() in players['team'][j].lower()):\n", " if(fc_players['surname'][i].lower() == players['surname'][j].lower()):\n", " # if(fc_players['initial'][i] == '' or fc_players['initial'][i].lower() == players['initial'][j].lower()):\n", " fc_players['fb_ID'][i] = j\n", " \n", " " ] }, { "cell_type": "code", "execution_count": 47, "id": "5a3e2771", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Mirante\n", "Ujkani\n", "Marchetti\n", "Cordaz\n", "Aresti\n", "Santurro\n", "Fuzato\n", "Rosati\n", "Boer\n", "Gasparini\n", "Furlan\n", "Adamonis\n", "Bertinato\n", "Molla\n", "Piana\n", "Neri\n", "Ostigard\n", "Fares\n", "Dalbert\n", "Czyborra\n", "Romagna\n", "Ballarini\n", "De Winter\n", "Ruiz\n", "Djuricic\n", "Gudmundsson A.\n", "Arthur\n", "Galdames\n", "Ciervo\n", "Sigurdsson A.\n", "Kingsley\n", "Obiang\n", "Akpa Akpro\n", "Leo' Sena\n", "Rojas\n", "Pecile\n", "Bianco\n", "Djuric\n", "Keita B.\n", "Supryaga\n", "Jovane\n", "Edera\n", "Munteanu\n", "Lazetic\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": 48, "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
04312PMaignanMilanMaignan647
1453PSzczesnyJuventusSzczesny675
22468POspinaNapoliOspina653
3250PHandanovicInterHandanovic644
4316PBerishaTorinoBerisha637
........................
5455391AKokorinFiorentinaKokorin281
5465458AMunteanuFiorentinaMunteanu-1
5475459ABuksaGenoaBuksa83
5485505AKaio JorgeJuventusJorge264
5495785ALazeticMilanLazetic-1
\n", "

550 rows × 7 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID\n", "0 4312 P Maignan Milan Maignan 647\n", "1 453 P Szczesny Juventus Szczesny 675\n", "2 2468 P Ospina Napoli Ospina 653\n", "3 250 P Handanovic Inter Handanovic 644\n", "4 316 P Berisha Torino Berisha 637\n", ".. ... .. ... ... ... ... ...\n", "545 5391 A Kokorin Fiorentina Kokorin 281\n", "546 5458 A Munteanu Fiorentina Munteanu -1\n", "547 5459 A Buksa Genoa Buksa 83\n", "548 5505 A Kaio Jorge Juventus Jorge 264\n", "549 5785 A Lazetic Milan Lazetic -1\n", "\n", "[550 rows x 7 columns]" ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players" ] }, { "cell_type": "code", "execution_count": 49, "id": "1d73a312", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:4: PerformanceWarning: DataFrame is highly fragmented. This is usually the result of calling `frame.insert` many times, which has poor performance. Consider joining all columns at once using pd.concat(axis=1) instead. To get a de-fragmented frame, use `newframe = frame.copy()`\n", " fc_players[columns_to_copy] = 0\n", "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\2261782218.py:9: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame\n", "\n", "See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy\n", " fc_players[columns_to_copy[j]][i] = outfield_players[columns_to_copy[j]][fc_players['fb_ID'][i]]\n" ] } ], "source": [ "#Data for Outfield players\n", "columns_to_copy = outfield_players.columns[4:]\n", "\n", "fc_players[columns_to_copy] = 0\n", "\n", "for i in range(fc_players.shape[0]):\n", " if(fc_players['fb_ID'][i] != -1 and fc_players['r'][i] != 'P'):\n", " for j in range(columns_to_copy.shape[0]):\n", " fc_players[columns_to_copy[j]][i] = outfield_players[columns_to_copy[j]][fc_players['fb_ID'][i]]\n", " " ] }, { "cell_type": "code", "execution_count": 50, "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": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "keeper_players.columns[4:]" ] }, { "cell_type": "code", "execution_count": 51, "id": "eb9127a9", "metadata": {}, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "C:\\Users\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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\\nicol\\AppData\\Local\\Temp\\ipykernel_4780\\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]" ] }, { "cell_type": "code", "execution_count": 52, "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 ITAGKSampdoria24199729.029.02560.048.0...36.3212.067.947.6418.022.05.325.00.8813.5
1Nicola Bagnoliniit ITAGKBologna1720041.00.03.00.0...61.01.0100.060.03.00.00.00.00.000.0
2Francesco Bardiit ITAGKBologna2919922.02.0177.02.0...33.013.038.532.124.02.08.30.00.005.5
3Vid Belecsi SVNGKSalernitana31199023.021.01938.049.0...39.5182.073.149.9329.012.03.614.00.6512.7
4Alessandro Berardiit ITAGKHellas Verona3019911.01.090.03.0...39.77.0100.058.712.00.00.00.00.000.0
5Etrit Berishaal ALBGKTorino32198910.010.0900.08.0...39.478.087.258.6148.07.04.710.01.0014.6
6Andrea Consigliit ITAGKSassuolo34198737.037.03322.063.0...30.9246.031.728.8491.021.04.330.00.8113.4
7Alessio Cragnoit ITAGKCagliari27199435.035.03150.063.0...39.4316.073.448.2484.022.04.533.00.9415.0
8Bartłomiej Drągowskipl POLGKFiorentina2319977.07.0556.08.0...30.839.043.640.261.02.03.320.03.2422.3
9Wladimiro Falconeit ITAGKSampdoria26199510.09.0855.014.0...33.274.070.345.0164.07.04.32.00.2110.2
10Vincenzo Fiorilloit ITAGKSalernitana3119901.01.090.05.0...36.412.083.350.816.00.00.00.00.004.0
11Luca Gemelloit ITAGKTorino2120001.01.090.00.0...47.83.0100.056.310.00.00.01.01.0021.0
12Samir Handanovićsi SVNGKInter37198437.037.03330.030.0...28.1142.020.426.5393.015.03.810.00.2711.2
13Luca Lezzeriniit ITAGKVenezia2619956.06.0495.09.0...30.344.034.131.0100.02.02.03.00.5513.8
14Niki Mäenpääfi FINGKVenezia36198517.016.01485.027.0...36.0143.039.235.4275.06.02.210.00.6110.8
15Mike Maignanfr FRAGKMilan26199532.032.02880.021.0...33.0149.038.936.5347.025.07.245.01.4116.8
16Davide Marfellait ITAGKNapoli2119991.00.011.00.0...15.00.00.00.01.00.00.00.00.000.0
17Alex Meretit ITAGKNapoli2419977.07.0619.06.0...25.136.025.026.589.03.03.45.00.7314.6
18Vanja Milinković-Savićrs SRBGKTorino24199727.027.02430.033.0...44.4169.091.166.3290.018.06.222.00.8114.3
19Lorenzo Montipòit ITAGKHellas Verona25199634.034.03060.050.0...42.3231.068.446.5495.021.04.223.00.6813.1
20Juan Mussoar ARGGKAtalanta27199433.033.02932.042.0...31.3208.069.249.7308.028.09.139.01.2016.5
21David Ospinaco COLGKNapoli32198831.031.02790.025.0...28.6135.014.122.5353.018.05.131.01.0017.0
22Daniele Padelliit ITAGKUdinese3519853.03.0270.08.0...29.622.050.040.956.01.01.82.00.6713.2
23Ivor Pandurhr CROGKHellas Verona2120003.03.0270.06.0...33.115.053.337.122.01.04.51.00.3311.3
24Rui Patríciopt PORGKRoma33198838.038.03420.043.0...34.2222.032.031.5393.012.03.126.00.6814.3
25Gianluca Pegoloit ITAGKSassuolo4019811.01.090.03.0...26.78.012.519.88.01.012.50.00.006.0
26Mattia Perinit ITAGKJuventus2819925.05.0405.07.0...29.626.023.129.277.01.01.34.00.8912.6
27Carlo Pinsoglioit ITAGKJuventus3119901.00.045.01.0...29.61.00.037.012.00.00.00.00.000.0
28Ivan Provedelit ITAGKSpezia27199431.031.02761.052.0...40.1229.069.451.7476.028.05.925.00.8111.8
29Ionuț Raduro ROUGKInter2419971.01.090.02.0...33.34.025.029.84.00.00.01.01.0016.0
30Boris Radunovićrs SRBGKCagliari2519963.03.0270.05.0...41.528.082.151.142.01.02.41.00.3313.8
31Nicola Ravagliait ITAGKSampdoria3219881.00.05.01.0...57.02.0100.065.51.00.00.00.00.000.0
32Pepe Reinaes ESPGKLazio38198215.015.01350.029.0...29.899.029.330.1186.010.05.410.00.6713.7
33Sergio Romeroar ARGGKVenezia34198716.016.01440.033.0...34.6142.045.838.8265.014.05.311.00.6911.8
34Francesco Rossiit ITAGKAtalanta3019911.00.037.01.0...37.84.025.039.33.00.00.00.00.0018.0
35Giacomo Satalinoit ITAGKSassuolo2219991.00.08.00.0...0.01.00.022.01.00.00.00.00.000.0
36Adrian Šemperhr CROGKGenoa2319981.01.090.01.0...38.57.085.752.014.02.014.30.00.0011.2
37Luigi Sepeit ITAGKSalernitana30199116.016.01392.024.0...40.8130.063.846.4235.010.04.313.00.8416.0
38Marco Silvestriit ITAGKUdinese30199135.035.03150.050.0...36.7252.046.838.4462.016.03.510.00.2911.0
39Salvatore Siriguit ITAGKGenoa34198737.037.03330.059.0...36.6263.068.845.9476.014.02.920.00.5412.9
40Łukasz Skorupskipl POLGKBologna30199136.036.03240.053.0...34.0294.028.926.6498.027.05.414.00.3911.3
41Marco Sportielloit ITAGKAtalanta2919925.05.0450.05.0...26.028.064.347.045.01.02.24.00.8013.9
42Thomas Strakoshaal ALBGKLazio26199523.023.02070.029.0...28.5119.020.223.6283.011.03.916.00.7014.5
43Wojciech Szczęsnypl POLGKJuventus31199033.033.02970.029.0...30.8172.029.731.5481.024.05.025.00.7613.5
44Ciprian Tătărușanuro ROUGKMilan3519866.06.0540.010.0...33.336.036.135.082.06.07.33.00.5012.5
45Pietro Terraccianoit ITAGKFiorentina31199032.031.02862.043.0...32.2170.035.333.7291.022.07.651.01.6016.7
46Guglielmo Vicarioit ITAGKEmpoli24199638.038.03420.070.0...29.5257.041.637.5602.035.05.838.01.0013.9
47Jeroen Zoetnl NEDGKSpezia3019917.07.0630.019.0...30.754.037.037.495.02.02.16.00.8616.4
48Petar Zovkoba BIHGKSpezia1920021.00.029.00.0...35.92.050.035.04.00.00.02.06.2128.5
\n", "

49 rows × 47 columns

\n", "
" ], "text/plain": [ " player nationality position team age \\\n", "0 Emil Audero it ITA GK Sampdoria 24 \n", "1 Nicola Bagnolini it ITA GK Bologna 17 \n", "2 Francesco Bardi it ITA GK Bologna 29 \n", "3 Vid Belec si SVN GK Salernitana 31 \n", "4 Alessandro Berardi it ITA GK Hellas Verona 30 \n", "5 Etrit Berisha al ALB GK Torino 32 \n", "6 Andrea Consigli it ITA GK Sassuolo 34 \n", "7 Alessio Cragno it ITA GK Cagliari 27 \n", "8 Bartłomiej Drągowski pl POL GK Fiorentina 23 \n", "9 Wladimiro Falcone it ITA GK Sampdoria 26 \n", "10 Vincenzo Fiorillo it ITA GK Salernitana 31 \n", "11 Luca Gemello it ITA GK Torino 21 \n", "12 Samir Handanović si SVN GK Inter 37 \n", "13 Luca Lezzerini it ITA GK Venezia 26 \n", "14 Niki Mäenpää fi FIN GK Venezia 36 \n", "15 Mike Maignan fr FRA GK Milan 26 \n", "16 Davide Marfella it ITA GK Napoli 21 \n", "17 Alex Meret it ITA GK Napoli 24 \n", "18 Vanja Milinković-Savić rs SRB GK Torino 24 \n", "19 Lorenzo Montipò it ITA GK Hellas Verona 25 \n", "20 Juan Musso ar ARG GK Atalanta 27 \n", "21 David Ospina co COL GK Napoli 32 \n", "22 Daniele Padelli it ITA GK Udinese 35 \n", "23 Ivor Pandur hr CRO GK Hellas Verona 21 \n", "24 Rui Patrício pt POR GK Roma 33 \n", "25 Gianluca Pegolo it ITA GK Sassuolo 40 \n", "26 Mattia Perin it ITA GK Juventus 28 \n", "27 Carlo Pinsoglio it ITA GK Juventus 31 \n", "28 Ivan Provedel it ITA GK Spezia 27 \n", "29 Ionuț Radu ro ROU GK Inter 24 \n", "30 Boris Radunović rs SRB GK Cagliari 25 \n", "31 Nicola Ravaglia it ITA GK Sampdoria 32 \n", "32 Pepe Reina es ESP GK Lazio 38 \n", "33 Sergio Romero ar ARG GK Venezia 34 \n", "34 Francesco Rossi it ITA GK Atalanta 30 \n", "35 Giacomo Satalino it ITA GK Sassuolo 22 \n", "36 Adrian Šemper hr CRO GK Genoa 23 \n", "37 Luigi Sepe it ITA GK Salernitana 30 \n", "38 Marco Silvestri it ITA GK Udinese 30 \n", "39 Salvatore Sirigu it ITA GK Genoa 34 \n", "40 Łukasz Skorupski pl POL GK Bologna 30 \n", "41 Marco Sportiello it ITA GK Atalanta 29 \n", "42 Thomas Strakosha al ALB GK Lazio 26 \n", "43 Wojciech Szczęsny pl POL GK Juventus 31 \n", "44 Ciprian Tătărușanu ro ROU GK Milan 35 \n", "45 Pietro Terracciano it ITA GK Fiorentina 31 \n", "46 Guglielmo Vicario it ITA GK Empoli 24 \n", "47 Jeroen Zoet nl NED GK Spezia 30 \n", "48 Petar Zovko ba BIH GK Spezia 19 \n", "\n", " birth_year gk_games gk_games_starts gk_minutes gk_goals_against ... \\\n", "0 1997 29.0 29.0 2560.0 48.0 ... \n", "1 2004 1.0 0.0 3.0 0.0 ... \n", "2 1992 2.0 2.0 177.0 2.0 ... \n", "3 1990 23.0 21.0 1938.0 49.0 ... \n", "4 1991 1.0 1.0 90.0 3.0 ... \n", "5 1989 10.0 10.0 900.0 8.0 ... \n", "6 1987 37.0 37.0 3322.0 63.0 ... \n", "7 1994 35.0 35.0 3150.0 63.0 ... \n", "8 1997 7.0 7.0 556.0 8.0 ... \n", "9 1995 10.0 9.0 855.0 14.0 ... \n", "10 1990 1.0 1.0 90.0 5.0 ... \n", "11 2000 1.0 1.0 90.0 0.0 ... \n", "12 1984 37.0 37.0 3330.0 30.0 ... \n", "13 1995 6.0 6.0 495.0 9.0 ... \n", "14 1985 17.0 16.0 1485.0 27.0 ... \n", "15 1995 32.0 32.0 2880.0 21.0 ... \n", "16 1999 1.0 0.0 11.0 0.0 ... \n", "17 1997 7.0 7.0 619.0 6.0 ... \n", "18 1997 27.0 27.0 2430.0 33.0 ... \n", "19 1996 34.0 34.0 3060.0 50.0 ... \n", "20 1994 33.0 33.0 2932.0 42.0 ... \n", "21 1988 31.0 31.0 2790.0 25.0 ... \n", "22 1985 3.0 3.0 270.0 8.0 ... \n", "23 2000 3.0 3.0 270.0 6.0 ... \n", "24 1988 38.0 38.0 3420.0 43.0 ... \n", "25 1981 1.0 1.0 90.0 3.0 ... \n", "26 1992 5.0 5.0 405.0 7.0 ... \n", "27 1990 1.0 0.0 45.0 1.0 ... \n", "28 1994 31.0 31.0 2761.0 52.0 ... \n", "29 1997 1.0 1.0 90.0 2.0 ... \n", "30 1996 3.0 3.0 270.0 5.0 ... \n", "31 1988 1.0 0.0 5.0 1.0 ... \n", "32 1982 15.0 15.0 1350.0 29.0 ... \n", "33 1987 16.0 16.0 1440.0 33.0 ... \n", "34 1991 1.0 0.0 37.0 1.0 ... \n", "35 1999 1.0 0.0 8.0 0.0 ... \n", "36 1998 1.0 1.0 90.0 1.0 ... \n", "37 1991 16.0 16.0 1392.0 24.0 ... \n", "38 1991 35.0 35.0 3150.0 50.0 ... \n", "39 1987 37.0 37.0 3330.0 59.0 ... \n", "40 1991 36.0 36.0 3240.0 53.0 ... \n", "41 1992 5.0 5.0 450.0 5.0 ... \n", "42 1995 23.0 23.0 2070.0 29.0 ... \n", "43 1990 33.0 33.0 2970.0 29.0 ... \n", "44 1986 6.0 6.0 540.0 10.0 ... \n", "45 1990 32.0 31.0 2862.0 43.0 ... \n", "46 1996 38.0 38.0 3420.0 70.0 ... \n", "47 1991 7.0 7.0 630.0 19.0 ... \n", "48 2002 1.0 0.0 29.0 0.0 ... \n", "\n", " gk_passes_length_avg gk_goal_kicks gk_pct_goal_kicks_launched \\\n", "0 36.3 212.0 67.9 \n", "1 61.0 1.0 100.0 \n", "2 33.0 13.0 38.5 \n", "3 39.5 182.0 73.1 \n", "4 39.7 7.0 100.0 \n", "5 39.4 78.0 87.2 \n", "6 30.9 246.0 31.7 \n", "7 39.4 316.0 73.4 \n", "8 30.8 39.0 43.6 \n", "9 33.2 74.0 70.3 \n", "10 36.4 12.0 83.3 \n", "11 47.8 3.0 100.0 \n", "12 28.1 142.0 20.4 \n", "13 30.3 44.0 34.1 \n", "14 36.0 143.0 39.2 \n", "15 33.0 149.0 38.9 \n", "16 15.0 0.0 0.0 \n", "17 25.1 36.0 25.0 \n", "18 44.4 169.0 91.1 \n", "19 42.3 231.0 68.4 \n", "20 31.3 208.0 69.2 \n", "21 28.6 135.0 14.1 \n", "22 29.6 22.0 50.0 \n", "23 33.1 15.0 53.3 \n", "24 34.2 222.0 32.0 \n", "25 26.7 8.0 12.5 \n", "26 29.6 26.0 23.1 \n", "27 29.6 1.0 0.0 \n", "28 40.1 229.0 69.4 \n", "29 33.3 4.0 25.0 \n", "30 41.5 28.0 82.1 \n", "31 57.0 2.0 100.0 \n", "32 29.8 99.0 29.3 \n", "33 34.6 142.0 45.8 \n", "34 37.8 4.0 25.0 \n", "35 0.0 1.0 0.0 \n", "36 38.5 7.0 85.7 \n", "37 40.8 130.0 63.8 \n", "38 36.7 252.0 46.8 \n", "39 36.6 263.0 68.8 \n", "40 34.0 294.0 28.9 \n", "41 26.0 28.0 64.3 \n", "42 28.5 119.0 20.2 \n", "43 30.8 172.0 29.7 \n", "44 33.3 36.0 36.1 \n", "45 32.2 170.0 35.3 \n", "46 29.5 257.0 41.6 \n", "47 30.7 54.0 37.0 \n", "48 35.9 2.0 50.0 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 47.6 418.0 22.0 \n", "1 60.0 3.0 0.0 \n", "2 32.1 24.0 2.0 \n", "3 49.9 329.0 12.0 \n", "4 58.7 12.0 0.0 \n", "5 58.6 148.0 7.0 \n", "6 28.8 491.0 21.0 \n", "7 48.2 484.0 22.0 \n", "8 40.2 61.0 2.0 \n", "9 45.0 164.0 7.0 \n", "10 50.8 16.0 0.0 \n", "11 56.3 10.0 0.0 \n", "12 26.5 393.0 15.0 \n", "13 31.0 100.0 2.0 \n", "14 35.4 275.0 6.0 \n", "15 36.5 347.0 25.0 \n", "16 0.0 1.0 0.0 \n", "17 26.5 89.0 3.0 \n", "18 66.3 290.0 18.0 \n", "19 46.5 495.0 21.0 \n", "20 49.7 308.0 28.0 \n", "21 22.5 353.0 18.0 \n", "22 40.9 56.0 1.0 \n", "23 37.1 22.0 1.0 \n", "24 31.5 393.0 12.0 \n", "25 19.8 8.0 1.0 \n", "26 29.2 77.0 1.0 \n", "27 37.0 12.0 0.0 \n", "28 51.7 476.0 28.0 \n", "29 29.8 4.0 0.0 \n", "30 51.1 42.0 1.0 \n", "31 65.5 1.0 0.0 \n", "32 30.1 186.0 10.0 \n", "33 38.8 265.0 14.0 \n", "34 39.3 3.0 0.0 \n", "35 22.0 1.0 0.0 \n", "36 52.0 14.0 2.0 \n", "37 46.4 235.0 10.0 \n", "38 38.4 462.0 16.0 \n", "39 45.9 476.0 14.0 \n", "40 26.6 498.0 27.0 \n", "41 47.0 45.0 1.0 \n", "42 23.6 283.0 11.0 \n", "43 31.5 481.0 24.0 \n", "44 35.0 82.0 6.0 \n", "45 33.7 291.0 22.0 \n", "46 37.5 602.0 35.0 \n", "47 37.4 95.0 2.0 \n", "48 35.0 4.0 0.0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 5.3 25.0 \n", "1 0.0 0.0 \n", "2 8.3 0.0 \n", "3 3.6 14.0 \n", "4 0.0 0.0 \n", "5 4.7 10.0 \n", "6 4.3 30.0 \n", "7 4.5 33.0 \n", "8 3.3 20.0 \n", "9 4.3 2.0 \n", "10 0.0 0.0 \n", "11 0.0 1.0 \n", "12 3.8 10.0 \n", "13 2.0 3.0 \n", "14 2.2 10.0 \n", "15 7.2 45.0 \n", "16 0.0 0.0 \n", "17 3.4 5.0 \n", "18 6.2 22.0 \n", "19 4.2 23.0 \n", "20 9.1 39.0 \n", "21 5.1 31.0 \n", "22 1.8 2.0 \n", "23 4.5 1.0 \n", "24 3.1 26.0 \n", "25 12.5 0.0 \n", "26 1.3 4.0 \n", "27 0.0 0.0 \n", "28 5.9 25.0 \n", "29 0.0 1.0 \n", "30 2.4 1.0 \n", "31 0.0 0.0 \n", "32 5.4 10.0 \n", "33 5.3 11.0 \n", "34 0.0 0.0 \n", "35 0.0 0.0 \n", "36 14.3 0.0 \n", "37 4.3 13.0 \n", "38 3.5 10.0 \n", "39 2.9 20.0 \n", "40 5.4 14.0 \n", "41 2.2 4.0 \n", "42 3.9 16.0 \n", "43 5.0 25.0 \n", "44 7.3 3.0 \n", "45 7.6 51.0 \n", "46 5.8 38.0 \n", "47 2.1 6.0 \n", "48 0.0 2.0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \n", "0 0.88 13.5 \n", "1 0.00 0.0 \n", "2 0.00 5.5 \n", "3 0.65 12.7 \n", "4 0.00 0.0 \n", "5 1.00 14.6 \n", "6 0.81 13.4 \n", "7 0.94 15.0 \n", "8 3.24 22.3 \n", "9 0.21 10.2 \n", "10 0.00 4.0 \n", "11 1.00 21.0 \n", "12 0.27 11.2 \n", "13 0.55 13.8 \n", "14 0.61 10.8 \n", "15 1.41 16.8 \n", "16 0.00 0.0 \n", "17 0.73 14.6 \n", "18 0.81 14.3 \n", "19 0.68 13.1 \n", "20 1.20 16.5 \n", "21 1.00 17.0 \n", "22 0.67 13.2 \n", "23 0.33 11.3 \n", "24 0.68 14.3 \n", "25 0.00 6.0 \n", "26 0.89 12.6 \n", "27 0.00 0.0 \n", "28 0.81 11.8 \n", "29 1.00 16.0 \n", "30 0.33 13.8 \n", "31 0.00 0.0 \n", "32 0.67 13.7 \n", "33 0.69 11.8 \n", "34 0.00 18.0 \n", "35 0.00 0.0 \n", "36 0.00 11.2 \n", "37 0.84 16.0 \n", "38 0.29 11.0 \n", "39 0.54 12.9 \n", "40 0.39 11.3 \n", "41 0.80 13.9 \n", "42 0.70 14.5 \n", "43 0.76 13.5 \n", "44 0.50 12.5 \n", "45 1.60 16.7 \n", "46 1.00 13.9 \n", "47 0.86 16.4 \n", "48 6.21 28.5 \n", "\n", "[49 rows x 47 columns]" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "keeper_players" ] }, { "cell_type": "code", "execution_count": 53, "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
04312PMaignanMilanMaignan6472619950...33.014938.936.5347257.2451.4116.8
1453PSzczesnyJuventusSzczesny6753119900...30.817229.731.5481245.0250.7613.5
22468POspinaNapoliOspina6533219880...28.613514.122.5353185.1311.0017.0
3250PHandanovicInterHandanovic6443719840...28.114220.426.5393153.8100.2711.2
4316PBerishaTorinoBerisha6373219890...39.47887.258.614874.7101.0014.6
..................................................................
5455391AKokorinFiorentinaKokorin2813019916...0.000.00.0000.000.000.0
5465458AMunteanuFiorentinaMunteanu-1000...0.000.00.0000.000.000.0
5475459ABuksaGenoaBuksa831820034...0.000.00.0000.000.000.0
5485505AKaio JorgeJuventusJorge2641920029...0.000.00.0000.000.000.0
5495785ALazeticMilanLazetic-1000...0.000.00.0000.000.000.0
\n", "

550 rows × 158 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 4312 P Maignan Milan Maignan 647 26 \n", "1 453 P Szczesny Juventus Szczesny 675 31 \n", "2 2468 P Ospina Napoli Ospina 653 32 \n", "3 250 P Handanovic Inter Handanovic 644 37 \n", "4 316 P Berisha Torino Berisha 637 32 \n", ".. ... .. ... ... ... ... ... ... \n", "545 5391 A Kokorin Fiorentina Kokorin 281 30 \n", "546 5458 A Munteanu Fiorentina Munteanu -1 0 \n", "547 5459 A Buksa Genoa Buksa 83 18 \n", "548 5505 A Kaio Jorge Juventus Jorge 264 19 \n", "549 5785 A Lazetic Milan Lazetic -1 0 \n", "\n", " birth_year games ... gk_passes_length_avg gk_goal_kicks \\\n", "0 1995 0 ... 33.0 149 \n", "1 1990 0 ... 30.8 172 \n", "2 1988 0 ... 28.6 135 \n", "3 1984 0 ... 28.1 142 \n", "4 1989 0 ... 39.4 78 \n", ".. ... ... ... ... ... \n", "545 1991 6 ... 0.0 0 \n", "546 0 0 ... 0.0 0 \n", "547 2003 4 ... 0.0 0 \n", "548 2002 9 ... 0.0 0 \n", "549 0 0 ... 0.0 0 \n", "\n", " gk_pct_goal_kicks_launched gk_goal_kick_length_avg gk_crosses \\\n", "0 38.9 36.5 347 \n", "1 29.7 31.5 481 \n", "2 14.1 22.5 353 \n", "3 20.4 26.5 393 \n", "4 87.2 58.6 148 \n", ".. ... ... ... \n", "545 0.0 0.0 0 \n", "546 0.0 0.0 0 \n", "547 0.0 0.0 0 \n", "548 0.0 0.0 0 \n", "549 0.0 0.0 0 \n", "\n", " gk_crosses_stopped gk_crosses_stopped_pct \\\n", "0 25 7.2 \n", "1 24 5.0 \n", "2 18 5.1 \n", "3 15 3.8 \n", "4 7 4.7 \n", ".. ... ... \n", "545 0 0.0 \n", "546 0 0.0 \n", "547 0 0.0 \n", "548 0 0.0 \n", "549 0 0.0 \n", "\n", " gk_def_actions_outside_pen_area gk_def_actions_outside_pen_area_per90 \\\n", "0 45 1.41 \n", "1 25 0.76 \n", "2 31 1.00 \n", "3 10 0.27 \n", "4 10 1.00 \n", ".. ... ... \n", "545 0 0.00 \n", "546 0 0.00 \n", "547 0 0.00 \n", "548 0 0.00 \n", "549 0 0.00 \n", "\n", " gk_avg_distance_def_actions \n", "0 16.8 \n", "1 13.5 \n", "2 17.0 \n", "3 11.2 \n", "4 14.6 \n", ".. ... \n", "545 0.0 \n", "546 0.0 \n", "547 0.0 \n", "548 0.0 \n", "549 0.0 \n", "\n", "[550 rows x 158 columns]" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players" ] }, { "cell_type": "code", "execution_count": 54, "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.2656250.483871
16.1212120.628012
26.2580650.332899
36.1621620.533399
46.1000000.700000
.........
5456.0215460.218643
5466.1024530.487258
5476.0481020.507697
5485.9493580.265907
5496.2439820.373505
\n", "

550 rows × 2 columns

\n", "
" ], "text/plain": [ " vote_avg vote_std\n", "0 6.265625 0.483871\n", "1 6.121212 0.628012\n", "2 6.258065 0.332899\n", "3 6.162162 0.533399\n", "4 6.100000 0.700000\n", ".. ... ...\n", "545 6.021546 0.218643\n", "546 6.102453 0.487258\n", "547 6.048102 0.507697\n", "548 5.949358 0.265907\n", "549 6.243982 0.373505\n", "\n", "[550 rows x 2 columns]" ] }, "execution_count": 54, "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": 55, "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
04312PMaignanMilanMaignan6472619950...38.936.5347257.2451.4116.86.2656250.483871
1453PSzczesnyJuventusSzczesny6753119900...29.731.5481245.0250.7613.56.1212120.628012
22468POspinaNapoliOspina6533219880...14.122.5353185.1311.0017.06.2580650.332899
3250PHandanovicInterHandanovic6443719840...20.426.5393153.8100.2711.26.1621620.533399
4316PBerishaTorinoBerisha6373219890...87.258.614874.7101.0014.66.1000000.700000
..................................................................
5455391AKokorinFiorentinaKokorin2813019916...0.00.0000.000.000.06.0215460.218643
5465458AMunteanuFiorentinaMunteanu-1000...0.00.0000.000.000.06.1024530.487258
5475459ABuksaGenoaBuksa831820034...0.00.0000.000.000.06.0481020.507697
5485505AKaio JorgeJuventusJorge2641920029...0.00.0000.000.000.05.9493580.265907
5495785ALazeticMilanLazetic-1000...0.00.0000.000.000.06.2439820.373505
\n", "

550 rows × 160 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 4312 P Maignan Milan Maignan 647 26 \n", "1 453 P Szczesny Juventus Szczesny 675 31 \n", "2 2468 P Ospina Napoli Ospina 653 32 \n", "3 250 P Handanovic Inter Handanovic 644 37 \n", "4 316 P Berisha Torino Berisha 637 32 \n", ".. ... .. ... ... ... ... ... ... \n", "545 5391 A Kokorin Fiorentina Kokorin 281 30 \n", "546 5458 A Munteanu Fiorentina Munteanu -1 0 \n", "547 5459 A Buksa Genoa Buksa 83 18 \n", "548 5505 A Kaio Jorge Juventus Jorge 264 19 \n", "549 5785 A Lazetic Milan Lazetic -1 0 \n", "\n", " birth_year games ... gk_pct_goal_kicks_launched \\\n", "0 1995 0 ... 38.9 \n", "1 1990 0 ... 29.7 \n", "2 1988 0 ... 14.1 \n", "3 1984 0 ... 20.4 \n", "4 1989 0 ... 87.2 \n", ".. ... ... ... ... \n", "545 1991 6 ... 0.0 \n", "546 0 0 ... 0.0 \n", "547 2003 4 ... 0.0 \n", "548 2002 9 ... 0.0 \n", "549 0 0 ... 0.0 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 36.5 347 25 \n", "1 31.5 481 24 \n", "2 22.5 353 18 \n", "3 26.5 393 15 \n", "4 58.6 148 7 \n", ".. ... ... ... \n", "545 0.0 0 0 \n", "546 0.0 0 0 \n", "547 0.0 0 0 \n", "548 0.0 0 0 \n", "549 0.0 0 0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 7.2 45 \n", "1 5.0 25 \n", "2 5.1 31 \n", "3 3.8 10 \n", "4 4.7 10 \n", ".. ... ... \n", "545 0.0 0 \n", "546 0.0 0 \n", "547 0.0 0 \n", "548 0.0 0 \n", "549 0.0 0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n", "0 1.41 16.8 \n", "1 0.76 13.5 \n", "2 1.00 17.0 \n", "3 0.27 11.2 \n", "4 1.00 14.6 \n", ".. ... ... \n", "545 0.00 0.0 \n", "546 0.00 0.0 \n", "547 0.00 0.0 \n", "548 0.00 0.0 \n", "549 0.00 0.0 \n", "\n", " vote_avg vote_std \n", "0 6.265625 0.483871 \n", "1 6.121212 0.628012 \n", "2 6.258065 0.332899 \n", "3 6.162162 0.533399 \n", "4 6.100000 0.700000 \n", ".. ... ... \n", "545 6.021546 0.218643 \n", "546 6.102453 0.487258 \n", "547 6.048102 0.507697 \n", "548 5.949358 0.265907 \n", "549 6.243982 0.373505 \n", "\n", "[550 rows x 160 columns]" ] }, "execution_count": 55, "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": 56, "id": "494db0f4", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Sportiello, 0.8333333333333334\n", "Bardi, 0.33333333333333337\n", "Padelli, 0.5\n", "Pinsoglio, 0.16666666666666663\n", "Semper, 0.16666666666666663\n", "Zovko, 0.16666666666666663\n", "Radunovic, 0.5\n", "Perin, 0.8333333333333334\n", "Mirante, 0.0\n", "Ujkani, 0.0\n", "Marchetti, 0.0\n", "Pegolo, 0.16666666666666663\n", "Radu I., 0.16666666666666663\n", "Cordaz, 0.0\n", "Aresti, 0.0\n", "Fiorillo, 0.16666666666666663\n", "Satalino, 0.16666666666666663\n", "Santurro, 0.0\n", "Rossi F., 0.16666666666666663\n", "Fuzato, 0.0\n", "Rosati, 0.0\n", "Berardi A., 0.16666666666666663\n", "Gemello, 0.16666666666666663\n", "Ravaglia, 0.16666666666666663\n", "Pandur, 0.5\n", "Boer, 0.0\n", "Gasparini, 0.0\n", "Furlan, 0.0\n", "Adamonis, 0.0\n", "Marfella, 0.16666666666666663\n", "Bertinato, 0.0\n", "Molla, 0.0\n", "Russo, 0.0\n", "Piana, 0.0\n", "Neri, 0.0\n" ] } ], "source": [ "min_gk_games = 6\n", "\n", "fc_players_newgk = fc_players.copy()\n", "\n", "columns_to_avg = fc_players.columns[123:] # from gk_games to end\n", "\n", "for i in range(fc_players.shape[0]):\n", " if(fc_players['r'][i] == 'P'):\n", " if(fc_players['gk_games'][i] < min_gk_games):\n", " for j in range(fc_players.shape[0]):\n", " if(fc_players['team'][i] == fc_players['team'][j] and fc_players['gk_games'][j] >= min_gk_games):\n", " break\n", " \n", " weight = 1 - (min_gk_games - fc_players['gk_games'][i]) / min_gk_games\n", " \n", " fc_players_newgk.at[i, columns_to_avg] = fc_players.loc[i][columns_to_avg] * weight + (1 - weight) * fc_players.loc[j][columns_to_avg]\n", " \n", " print(fc_players['name'][i] + ', ' + str(weight))\n", " \n", " " ] }, { "cell_type": "code", "execution_count": 57, "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
04312PMaignanMilanMaignan6472619950...38.936.5347.025.07.245.01.4116.86.2656250.483871
1453PSzczesnyJuventusSzczesny6753119900...29.731.5481.024.05.025.00.7613.56.1212120.628012
22468POspinaNapoliOspina6533219880...14.122.5353.018.05.131.01.0017.06.2580650.332899
3250PHandanovicInterHandanovic6443719840...20.426.5393.015.03.810.00.2711.26.1621620.533399
4316PBerishaTorinoBerisha6373219890...87.258.6148.07.04.710.01.0014.66.1000000.700000
..................................................................
5455391AKokorinFiorentinaKokorin2813019916...0.00.00.00.00.00.00.000.06.0215460.218643
5465458AMunteanuFiorentinaMunteanu-1000...0.00.00.00.00.00.00.000.06.1024530.487258
5475459ABuksaGenoaBuksa831820034...0.00.00.00.00.00.00.000.06.0481020.507697
5485505AKaio JorgeJuventusJorge2641920029...0.00.00.00.00.00.00.000.05.9493580.265907
5495785ALazeticMilanLazetic-1000...0.00.00.00.00.00.00.000.06.2439820.373505
\n", "

550 rows × 160 columns

\n", "
" ], "text/plain": [ " id r name team surname initial fb_ID age \\\n", "0 4312 P Maignan Milan Maignan 647 26 \n", "1 453 P Szczesny Juventus Szczesny 675 31 \n", "2 2468 P Ospina Napoli Ospina 653 32 \n", "3 250 P Handanovic Inter Handanovic 644 37 \n", "4 316 P Berisha Torino Berisha 637 32 \n", ".. ... .. ... ... ... ... ... ... \n", "545 5391 A Kokorin Fiorentina Kokorin 281 30 \n", "546 5458 A Munteanu Fiorentina Munteanu -1 0 \n", "547 5459 A Buksa Genoa Buksa 83 18 \n", "548 5505 A Kaio Jorge Juventus Jorge 264 19 \n", "549 5785 A Lazetic Milan Lazetic -1 0 \n", "\n", " birth_year games ... gk_pct_goal_kicks_launched \\\n", "0 1995 0 ... 38.9 \n", "1 1990 0 ... 29.7 \n", "2 1988 0 ... 14.1 \n", "3 1984 0 ... 20.4 \n", "4 1989 0 ... 87.2 \n", ".. ... ... ... ... \n", "545 1991 6 ... 0.0 \n", "546 0 0 ... 0.0 \n", "547 2003 4 ... 0.0 \n", "548 2002 9 ... 0.0 \n", "549 0 0 ... 0.0 \n", "\n", " gk_goal_kick_length_avg gk_crosses gk_crosses_stopped \\\n", "0 36.5 347.0 25.0 \n", "1 31.5 481.0 24.0 \n", "2 22.5 353.0 18.0 \n", "3 26.5 393.0 15.0 \n", "4 58.6 148.0 7.0 \n", ".. ... ... ... \n", "545 0.0 0.0 0.0 \n", "546 0.0 0.0 0.0 \n", "547 0.0 0.0 0.0 \n", "548 0.0 0.0 0.0 \n", "549 0.0 0.0 0.0 \n", "\n", " gk_crosses_stopped_pct gk_def_actions_outside_pen_area \\\n", "0 7.2 45.0 \n", "1 5.0 25.0 \n", "2 5.1 31.0 \n", "3 3.8 10.0 \n", "4 4.7 10.0 \n", ".. ... ... \n", "545 0.0 0.0 \n", "546 0.0 0.0 \n", "547 0.0 0.0 \n", "548 0.0 0.0 \n", "549 0.0 0.0 \n", "\n", " gk_def_actions_outside_pen_area_per90 gk_avg_distance_def_actions \\\n", "0 1.41 16.8 \n", "1 0.76 13.5 \n", "2 1.00 17.0 \n", "3 0.27 11.2 \n", "4 1.00 14.6 \n", ".. ... ... \n", "545 0.00 0.0 \n", "546 0.00 0.0 \n", "547 0.00 0.0 \n", "548 0.00 0.0 \n", "549 0.00 0.0 \n", "\n", " vote_avg vote_std \n", "0 6.265625 0.483871 \n", "1 6.121212 0.628012 \n", "2 6.258065 0.332899 \n", "3 6.162162 0.533399 \n", "4 6.100000 0.700000 \n", ".. ... ... \n", "545 6.021546 0.218643 \n", "546 6.102453 0.487258 \n", "547 6.048102 0.507697 \n", "548 5.949358 0.265907 \n", "549 6.243982 0.373505 \n", "\n", "[550 rows x 160 columns]" ] }, "execution_count": 57, "metadata": {}, "output_type": "execute_result" } ], "source": [ "fc_players = fc_players_newgk\n", "\n", "fc_players" ] }, { "cell_type": "code", "execution_count": 58, "id": "8336c025", "metadata": {}, "outputs": [], "source": [ "fc_players.to_excel('mid_outputs/season' + season + '/players_stats.xlsx')" ] }, { "cell_type": "code", "execution_count": null, "id": "b7a7c972", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "f3fc9b1b", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.13" } }, "nbformat": 4, "nbformat_minor": 5 }