{"id":1038,"date":"2024-05-13T08:41:46","date_gmt":"2024-05-13T08:41:46","guid":{"rendered":"https:\/\/javierladino.com\/fr\/?post_type=rara-portfolio&#038;p=1038"},"modified":"2024-06-17T21:54:52","modified_gmt":"2024-06-17T21:54:52","slug":"decouvrir-le-monde-de-league-of-legends-grace-aux-donnees","status":"publish","type":"rara-portfolio","link":"https:\/\/javierladino.com\/fr\/portfolio\/decouvrir-le-monde-de-league-of-legends-grace-aux-donnees\/","title":{"rendered":"D\u00e9couvrir le monde de League of Legends gr\u00e2ce aux donn\u00e9es"},"content":{"rendered":"\n<p>Bonjour, je partage avec vous ce parcours personnel, en tant que fan d&rsquo;un grand joueur de League of Legends (LoL) appel\u00e9 <strong>IM ONI<\/strong>, et comment \u00e0 travers les donn\u00e9es que le jeu offre, j&rsquo;ai lentement r\u00e9ussi \u00e0 avancer dans ma reconversion professionnelle vers la Data Science et l&rsquo;Ing\u00e9nierie des Donn\u00e9es. Dans ce billet, je vais vous faire d\u00e9couvrir mon exp\u00e9rience et mettre en lumi\u00e8re la mani\u00e8re dont j&rsquo;ai utilis\u00e9 mes comp\u00e9tences pour analyser et visualiser des donn\u00e9es issues du monde de LoL.<\/p>\n\n\n\n<p>Comme beaucoup, je suis devenu un grand fan d&rsquo;<strong>IM ONI<\/strong> en raison de leur expertise dans le monde de LoL. Cependant, mon int\u00e9r\u00eat ne s&rsquo;est pas limit\u00e9 \u00e0 regarder ses matchs ; j&rsquo;ai \u00e9galement voulu comprendre les donn\u00e9es qui sous-tendent son jeu et d\u00e9couvrir des mod\u00e8les et des tendances qui pourraient expliquer son jeu. Ce d\u00e9sir d&rsquo;explorer et d&rsquo;analyser les donn\u00e9es m&rsquo;a conduit \u00e0 m&#8217;embarquer dans un voyage qui relie l&rsquo;extraction, la transformation et le chargement &#8211; ETL &#8211; des donn\u00e9es LOL, la visualisation et une premi\u00e8re analyse.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/immoni-1024x367.jpg\" alt=\"Im ONI\" class=\"wp-image-1162\"\/><figcaption class=\"wp-element-caption\"><a href=\"https:\/\/www.twitch.tv\/im__oni\" target=\"_blank\" rel=\"noreferrer noopener\">Twitch &#8211; Im ONI &#8211; LoL<\/a><\/figcaption><\/figure>\n\n\n\n<p><strong>League of Legends (LoL):<\/strong> est un jeu vid\u00e9o en ligne populaire du genre MOBA (Multiplayer Online Battle Arena) d\u00e9velopp\u00e9 et publi\u00e9 par Riot Games. Dans LoL, les joueurs contr\u00f4lent un personnage, appel\u00e9 \u00ab\u00a0champion\u00a0\u00bb, dot\u00e9 de capacit\u00e9s uniques, et travaillent en \u00e9quipe pour d\u00e9truire la base ennemie tout en d\u00e9fendant la leur. Le jeu se distingue par l&rsquo;importance qu&rsquo;il accorde \u00e0 la strat\u00e9gie, \u00e0 la coop\u00e9ration au sein de l&rsquo;\u00e9quipe et aux comp\u00e9tences individuelles.<\/p>\n\n\n\n<p>Selon le portail <a href=\"https:\/\/activeplayer.io\/league-of-legends\/\" target=\"_blank\" rel=\"noreferrer noopener\">Active Player<\/a>:  \u00e0 l&rsquo;heure o\u00f9 nous \u00e9crivons ces lignes, <strong>1 050 863<\/strong> personnes jouent en ligne, au cours des 30 derniers jours, plus de <strong>133 466 282<\/strong> joueurs se sont connect\u00e9s et plus de <strong>97 975 355 <\/strong>heures ont \u00e9t\u00e9 regard\u00e9es sur Twitch, avec un pic de <strong>712 950<\/strong> spectateurs simultan\u00e9s.<\/p>\n\n\n\n<p><kbd><strong><kbd><strong>Il est important de souligner l'aide du contenu de deux Youtubers<\/strong><\/kbd> <a href=\"https:\/\/www.youtube.com\/@CodinEric\" target=\"_blank\" rel=\"noreferrer noopener\">CodinEric<\/a> et <a href=\"https:\/\/www.youtube.com\/@itero_gaming\" target=\"_blank\" rel=\"noreferrer noopener\">Jack J de iTero Gaming<\/a> qui m'ont servi de r\u00e9f\u00e9rence avec leurs vid\u00e9os et leurs explications. Il ne s'agissait pas seulement de suivre leur code, mais aussi de comprendre le processus et la logique de programmation qu'ils utilisent pour traiter les donn\u00e9es.<\/strong><\/kbd><\/p>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-921ed8b0cd09dcd4810034513ae764c4\"><strong>Configuration de l&rsquo;environnement de d\u00e9veloppement<\/strong><\/p>\n\n\n\n<p>Ma premi\u00e8re \u00e9tape a \u00e9t\u00e9 de mettre en place mon environnement de d\u00e9veloppement, en installant les biblioth\u00e8ques Python n\u00e9cessaires et en obtenant une cl\u00e9 API de Riot Games pour acc\u00e9der aux API de LoL. Cette configuration initiale \u00e9tait cruciale pour pouvoir acc\u00e9der aux donn\u00e9es du jeu et commencer mon analyse.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Environnement de d\u00e9veloppement :<\/mark><\/strong> j&rsquo;ai utilis\u00e9 <strong>JupyterLab<\/strong> pour \u00e9crire le Notebook avec <strong>Python<\/strong> localement. J&rsquo;utilise toujours <strong>Conda<\/strong> pour g\u00e9n\u00e9rer un environnement et installer les biblioth\u00e8ques en fonction des besoins.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Libraries\nimport requests\nfrom time import sleep\nimport pandas as pd\nfrom datetime import datetime\nimport matplotlib.pyplot as plt\nimport seaborn as sns\nimport plotly.graph_objs as go\nimport plotly.express as px<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Cl\u00e9 API de Riot Games :<\/mark><\/strong> rendez-vous sur <a href=\"https:\/\/developer.riotgames.com\/\">https:\/\/developer.riotgames.com\/<\/a>, puis cr\u00e9ez ou connectez-vous avec votre compte Riot et acceptez les conditions d&rsquo;utilisation. En bas de la page, cliquez sur \u00ab\u00a0I&rsquo;m not a robot\u00a0\u00bb et r\u00e9g\u00e9n\u00e9rez votre cl\u00e9 API. En raison des politiques de s\u00e9curit\u00e9 de Riot Games, cette cl\u00e9 est d\u00e9sactiv\u00e9e toutes les 24 heures ou moins selon les instructions de Riot Games, vous devrez donc r\u00e9p\u00e9ter la proc\u00e9dure autant de fois que n\u00e9cessaire pendant le projet. Pour des raisons pratiques, je rendrai la \u00ab\u00a0api_key\u00a0\u00bb visible sur le notebook, mais je pr\u00e9cise qu&rsquo;il s&rsquo;agit d&rsquo;une mauvaise pratique.<br><br>Copiez donc la cl\u00e9 API et collez-la dans votre notebook sous la variable \u00ab\u00a0api_key\u00a0\u00bb, exemple :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>api_key<\/strong> = 'RGAPI-0f2ead54-465c-2323-8bd6-c123456789'<\/code><\/pre>\n\n\n\n<p><kbd><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-luminous-vivid-orange-color\">Il est tr\u00e8s important de comprendre que vous NE DEVEZ PAS partager vos mots de passe en public<\/mark><\/strong>, normalement vous pouvez utiliser des variables d'environnement qui contiennent votre mot de passe et au moment de la publication de votre code elles ne sont pas visibles (je l'ai compris comme un GitIgnore, pour ne pas t\u00e9l\u00e9charger ou rendre visible ce que vous ne voulez pas). <\/kbd><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Insert an environment variable:\n\"\"\"\n1 - Create an .env file in the root of the project.\n2 - $ export api_key = RGAPI-1234567-1234567890\n3 - $ source -env\n\"\"\"\n# api_key = os.environ&#91;'api_key'] =&gt; To call the environment variable.<\/code><\/pre>\n\n\n\n<p><strong>Utilitaire de consommation de l&rsquo;API de League of Legends<\/strong><\/p>\n\n\n\n<p>L&rsquo;utilisation de l&rsquo;API League of Legends permet d&rsquo;acc\u00e9der \u00e0 une multitude de donn\u00e9es sur le jeu, les joueurs et les parties. Ces donn\u00e9es peuvent \u00eatre utilis\u00e9es \u00e0 diverses fins, notamment :<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><strong>Analyse des performances des joueurs<\/strong> : les donn\u00e9es de jeu peuvent \u00eatre utilis\u00e9es pour analyser les performances des joueurs, identifier les points \u00e0 am\u00e9liorer et comparer les statistiques avec celles d&rsquo;autres joueurs.<\/li>\n\n\n\n<li><strong>Recherche de strat\u00e9gies et de tendances<\/strong> : l&rsquo;analyse des donn\u00e9es de jeu permet d&rsquo;identifier les tendances dans la s\u00e9lection des champions, les strat\u00e9gies de jeu et les r\u00e9sultats de jeu, ce qui peut aider les joueurs \u00e0 am\u00e9liorer leur strat\u00e9gie et \u00e0 s&rsquo;adapter \u00e0 la m\u00e9ta actuelle.<\/li>\n\n\n\n<li><strong>Visualisation des donn\u00e9es<\/strong> : Les donn\u00e9es de jeu peuvent \u00eatre visualis\u00e9es de diff\u00e9rentes mani\u00e8res, telles que des graphiques interactifs, afin de mieux comprendre les dynamiques de jeu, de partager les r\u00e9sultats et de r\u00e9diger des rapports d\u00e9taill\u00e9s.<\/li>\n\n\n\n<li><strong>Recherche universitaire<\/strong> : les donn\u00e9es de League of Legends peuvent \u00e9galement \u00eatre utilis\u00e9es \u00e0 des fins universitaires, telles que l&rsquo;\u00e9tude du comportement des joueurs, l&rsquo;analyse des r\u00e9seaux sociaux et la mod\u00e9lisation de syst\u00e8mes complexes.<\/li>\n<\/ol>\n\n\n\n<p>En r\u00e9sum\u00e9, l&rsquo;utilisation de l&rsquo;API de League of Legends constitue une source pr\u00e9cieuse de donn\u00e9es pour analyser et comprendre le jeu, ainsi que pour am\u00e9liorer les performances individuelles et collectives des joueurs.<\/p>\n\n\n\n<p>Une documentation compl\u00e8te sur la mani\u00e8re d&rsquo;utiliser les API de LOL est disponible \u00e0 l&rsquo;adresse suivante : <a href=\"https:\/\/developer.riotgames.com\/docs\/lol\">https:\/\/developer.riotgames.com\/docs\/lol<\/a>.<\/p>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-dfb48a5b1b9ea5648c8bf04638b4bb49\"><strong>Interrogation des donn\u00e9es des joueurs<\/strong><\/p>\n\n\n\n<p>En utilisant les API de LoL, j&rsquo;ai pu obtenir des informations d\u00e9taill\u00e9es sur les joueurs, notamment leur nom d&rsquo;invocateur, leur niveau, leur historique de jeu, etc. Cela m&rsquo;a permis d&rsquo;\u00e9tudier les performances de diff\u00e9rents joueurs, dont <strong>IM ONI<\/strong>.<\/p>\n\n\n\n<p>Au d\u00e9part, nous ne connaissons que le nom du joueur \u00ab\u00a0invocateur\u00a0\u00bb et la r\u00e9gion (serveur) o\u00f9 il joue, dans notre cas : <strong>IM ONI et euw (serveur en Europe)<\/strong>.<\/p>\n\n\n\n<p>Jusqu&rsquo;en novembre 2023, vous pouvez utiliser l&rsquo;API \u00ab\u00a0<strong>Summoner-V4<\/strong>\u00a0\u00bb dans son point de terminaison \u00ab\u00a0\/lol\/summoner\/v4\/summoners\/by-name\/{summonerName}\u00a0\u00bb pour obtenir l&rsquo;ID du joueur. Riot Games utilise trois (3) identifiants diff\u00e9rents pour le suivre : le <strong>PUUID<\/strong>, le <strong>SummonerId<\/strong> et le <strong>AccountId<\/strong>. En fait, les deux premiers sont en vigueur et sont n\u00e9cessaires pour effectuer des requ\u00eates en fonction du point de terminaison (emplacement de l&rsquo;API o\u00f9 un syst\u00e8me interagit avec une API web).<\/p>\n\n\n\n<p>Actuellement,<strong><a href=\"https:\/\/www.riotgames.com\/en\/DevRel\/summoner-names-to-riot-id\" target=\"_blank\" rel=\"noreferrer noopener\"> Riot Games propose d&rsquo;utiliser l&rsquo;API \u00ab\u00a0Account-v1\u00a0\u00bb pour obtenir le PUUID<\/a><\/strong> (Player Universal Unique Identifiers), qui est une cha\u00eene (jusqu&rsquo;\u00e0 78 caract\u00e8res) permettant de suivre le joueur dans le monde entier, m\u00eame s&rsquo;il change de r\u00e9gion (serveur).<\/p>\n\n\n\n<p>Pour l&rsquo;obtenir, allez au point de terminaison \u00ab\u00a0<kbd>\/riot\/account\/v1\/accounts\/by-riot-id\/{gameName}\/{tagLine}<\/kbd>\u00a0\u00bb dans l&rsquo;API \u00ab\u00a0<strong>Account-V1<\/strong>\u00a0\u00bb que vous pouvez trouver lorsque vous vous connectez avec votre compte sur <strong><a href=\"http:\/\/developer.riotgames.com\/apis\" target=\"_blank\" rel=\"noreferrer noopener\">developer.riotgames.com\/apis<\/a><\/strong>. Dans la section \u00ab\u00a0Path parameters\u00a0\u00bb ins\u00e9rez dans \u00ab\u00a0tagLine\u00a0\u00bb = <strong>euw1<\/strong> (r\u00e9gion du joueur) et dans \u00ab\u00a0gameName\u00a0\u00bb = <strong>IIM ONI<\/strong> (nom du joueur), s\u00e9lectionnez EUROPE (ou la r\u00e9gion du joueur) et ex\u00e9cutez la requ\u00eate. Cela g\u00e9n\u00e9rera une URL avec les donn\u00e9es en retour.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/api_1.jpg\" alt=\"\" class=\"wp-image-1167\"\/><\/figure>\n\n\n\n<p>Vous copiez l&rsquo;URL qu&rsquo;il g\u00e9n\u00e8re et la collez dans votre notebook en tant que nouvelle variable \u00ab\u00a0api_url\u00a0\u00bb.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>api_url =  https:\/\/europe.api.riotgames.com\/riot\/account\/v1\/accounts\/by-riot-id\/IIM%20ONI\/EUW?api_key=RGAPI-0f2ead89-905c-4393-8bd6-c123456789\"<\/code><\/pre>\n\n\n\n<p>Ensuite, avec la biblioth\u00e8que \u00ab\u00a0<strong>requests<\/strong>\u00a0\u00bb d\u00e9j\u00e0 install\u00e9e, nous validons la connexion comme suit :<br><strong>requests.get(api_url)<br>&lt;Response [200]><\/strong><\/p>\n\n\n\n<p>Vous devriez obtenir une r\u00e9ponse [200] comme une connexion r\u00e9ussie. Si vous obtenez une r\u00e9ponse d&rsquo;erreur de connexion telle que \u00ab\u00a0400, 401, etc.\u00a0\u00bb, validez dans la liste des r\u00e9ponses d&rsquo;erreur de chaque point de terminaison (en g\u00e9n\u00e9ral, vous obtiendrez une erreur parce que la cl\u00e9 api a expir\u00e9 et que vous devrez en cr\u00e9er une nouvelle).<\/p>\n\n\n\n<p>Vous pouvez ensuite acc\u00e9der aux informations au format <strong>Json<\/strong> et les enregistrer dans une variable.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resp = requests.get(api_url)\nplayer_info = resp.json()\n<strong>player_info<\/strong>\n$ {<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">'puuid': '3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ'<\/mark>,\n 'gameName': 'IIM ONI',\n 'tagLine': 'EUW'}<\/code><\/pre>\n\n\n\n<p>Maintenant, avec le <strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">PUUID<\/mark><\/strong>, nous obtenons l&rsquo;ID SUMMONER avec le point de terminaison \u00ab\u00a0<kbd>\/lol\/summoner\/v4\/summoners\/by-puuid\/{encryptedPUID}<\/kbd>\u00ab\u00a0.<\/p>\n\n\n\n<p>Nous effectuons la m\u00eame proc\u00e9dure dans l&rsquo;API \u00ab\u00a0<strong>Summoner-V4<\/strong>\u00a0\u00bb et obtenons une nouvelle URL :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>api_url = 'https:\/\/euw1.api.riotgames.com\/lol\/summoner\/v4\/summoners\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ?api_key=RGAPI-0f2ead12-123c-1234-1bd2-c0123456789'\n\nresp = requests.get(api_url)\nsummoner = resp.json()\n<strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">summoner<\/mark><\/strong>\n$ {<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">'id': 'GKLboy4jZh2vTZDsax2s9lX3hfceyCbHzAdc0j5nPkpbgy4F'<\/mark>,\n 'accountId': 'w6J4cvKF2LD5XyIDo9kxTAEymbFe0dil8UwtJ3EaMs_ylwrloap3YO62',\n 'puuid': '3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ',\n 'profileIconId': 6503,\n 'revisionDate': 1713898945000,\n 'summonerLevel': 329}<\/code><\/pre>\n\n\n\n<p>Avec le \u00ab\u00a0<strong>Puuid<\/strong>\u00a0\u00bb et le \u00ab\u00a0<strong>SummonerId<\/strong>\u00ab\u00a0, nous pourrons interroger d&rsquo;autres APIS comme \u00ab\u00a0<strong>League-V4<\/strong>\u00a0\u00bb ou \u00ab\u00a0<strong>Champion-mastery<\/strong>\u00ab\u00a0.<\/p>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-079dd14967d953dffe3808f3f0cd2dde\"><strong>Collecte de donn\u00e9es sur les jeux<\/strong><\/p>\n\n\n\n<p>L&rsquo;exploration des donn\u00e9es de jeux r\u00e9cents a \u00e9t\u00e9 particuli\u00e8rement passionnante. J&rsquo;ai pu acc\u00e9der \u00e0 des informations d\u00e9taill\u00e9es sur les parties, telles que les champions s\u00e9lectionn\u00e9s, les r\u00e9sultats des parties et les statistiques des parties. Cela m&rsquo;a permis d&rsquo;identifier des tendances et des strat\u00e9gies communes parmi les joueurs des parties. N&rsquo;oubliez pas que LOL est un jeu \u00e0 cinq contre cinq, mais qu&rsquo;un joueur peut s&rsquo;affronter seul et monter en niveau.<\/p>\n\n\n\n<p>La premi\u00e8re chose que l&rsquo;on vous demande lorsque vous jouez \u00e0 LOL est quel est votre niveau de classement, donc pour trouver le classement de votre joueur, nous allons interroger l&rsquo;API \u00ab\u00a0<strong>League-v4<\/strong>\u00a0\u00bb dans le point de terminaison \u00ab\u00a0<kbd>\/lol\/league\/v4\/entries\/by-summoner\/{encryptedSummonerId}<\/kbd>\u00ab\u00a0, cette information sera le <strong>Ranking Mastery<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>summ_id = summoner&#91;'id']\nendpoint = f'https:\/\/euw1.api.riotgames.com\/lol\/league\/v4\/entries\/by-summoner\/{summ_id}?api_key={api_key}'\n\nres = requests.get(endpoint).json()\ndf_rank = pd.DataFrame(&#91;res&#91;0]]) # create dataframe with Ranking Mastery\n<strong>df_rank<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/ranking_mastery.jpg\" alt=\"\" class=\"wp-image-1173\"\/><\/figure>\n\n\n\n<p>C&rsquo;est maintenant au tour des donn\u00e9es de match, pour cela nous utiliserons l&rsquo;API \u00ab\u00a0<strong>Match-v5<\/strong>\u00a0\u00bb avec le <strong>PUUID<\/strong> que nous avons obtenu.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>api_url = \"https:\/\/europe.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?start=0&amp;count=20&amp;api_key=RGAPI-0f2ead89-905c-4393-8bd6-12345678\"\n\n<strong># First we bring the Ids for the last 20 games\n<\/strong>resp = requests.get(api_url)\nmatch_ids = resp.json()\n\n<strong>match_ids<\/strong>\n\n&#91;<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">'EUW1_6832340332'<\/mark>,\n 'EUW1_6832299147',\n 'EUW1_6829175370',\n 'EUW1_6829148496',\n 'EUW1_6829025866',\n 'EUW1_6828945398',\n 'EUW1_6828887595',\n 'EUW1_6828867611',\n 'EUW1_6828812533',\n 'EUW1_6824214120',\n 'EUW1_6824173176',\n 'EUW1_6824124368',\n 'EUW1_6823607057',\n 'EUW1_6823569193',\n 'EUW1_6816330441',\n 'EUW1_6816300579',\n 'EUW1_6814475777',\n 'EUW1_6814449666',\n 'EUW1_6811931211',\n 'EUW1_6811890150']<\/code><\/pre>\n\n\n\n<p>Nous filtrons les d\u00e9parts les plus r\u00e9cents :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>recent_match = match_ids&#91;0]\n<strong>recent_match<\/strong>\n<mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">'EUW1_6832340332'<\/mark><\/code><\/pre>\n\n\n\n<p>Nous utilisons l&rsquo;API \u00ab\u00a0<kbd>\/lol\/match\/v5\/matches\/{matchId}<\/kbd>\u00a0\u00bb pour extraire les donn\u00e9es du jeu avec son identifiant.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>api_url<\/strong> = \"https:\/\/europe.api.riotgames.com\/lol\/match\/v5\/matches\/EUW1_6832340332?api_key=RGAPI-0f2ead89-905c-4393-8bd6-1234567\"<\/code><\/pre>\n\n\n\n<p>resp = requests.get(api_url)<br>match_data = resp.json()<br><strong>match_data<\/strong><\/p>\n\n\n\n<p>Cela renvoie un fichier Json de <strong>2823<\/strong> lignes de code. Voici les 20 premi\u00e8res :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>{'metadata': {'dataVersion': '2',\n  'matchId': 'EUW1_6832340332',\n  'participants': &#91;'q0gtmms-y3amkJoRws5bFeAmP6a9XmfuwXFOVshyby8dNHkiGlFq0ao-Uxe21RfBKosrEbiR7CT-5w',\n   'pSH5lRUAcE0Cqk-bKTlH0IYFZa8pfpXT6rQf8ybaRmnSJv0LNiCaXUeYqy6wJ36duvYDIl6u8lmzaA',\n   '3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ',\n   '81pnwBf13NcO4q0k2EdH-nE3NsjJnlrYXdiR1xnKmff2qs_cLz-D540Q-RjgrSa-dA4sbmsAq-JTjQ',\n   'XjEV9TRmLaQoRx4tBl99oztaP8rCOJxCTghiJBeoqGGi0Wcv7O2c-utaW_-t797QFW-xZg1iRMSamg',\n   '23prBqAyWrlkEK89A29ACLZ9pDKNxcIe5cR4SOdhmyyvtxwsU0O0k2SUnx2xzPcWgqh1IK8ltpk1qQ',\n   'UteRJTU3g1NP_67ENlqRpX8QhTO8OooBHF4S32bvEFutfaMeQQipmfmi1ExMTJCHos4glinM7ZJEWw',\n   'G-Lj_m6A3K4pvid9h6b-M9h17D5_-uhPA6HD4ujt78EIq1bx4Dga-Tyb4RujvvGk5cdZtvygp96vFA',\n   'M0j0ja9BC0OjyUg-MCF3YpdU3U-_SMpvTUq7Kxzh9GSvwil3RiBs6O50qGARFYnoiyr4zzsXtpsKIg',\n   'G5R1mdsETPnJNKub3tmpI7LqWchEp2dOao_coGZerFMjybtRwKk7ShHposUGWMk53y_F1b0WjCbPjA']},\n 'info': {'endOfGameResult': 'GameComplete',\n  'gameCreation': 1708906756855,\n  'gameDuration': 1829,\n  'gameEndTimestamp': 1708908667752,\n  'gameId': 6832340332,\n  'gameMode': 'CLASSIC',\n  'gameName': 'teambuilder-match-6832340332',\n  'gameStartTimestamp': 1708906838802,\n...<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>Match_data<\/strong> has two sections\nmatch_data.keys()\ndict_keys(&#91;'<strong>metadata<\/strong>', '<strong>info<\/strong>'])\n\n# \"<strong>Metadata<\/strong>\" contains the puuid of each player in list '<strong>participants<\/strong>'.\nmatch_data&#91;'metadata'] # This returns the PUUID of all 10 players in the game.\n\n{'dataVersion': '2',\n 'matchId': 'EUW1_6832340332',\n 'participants': &#91;'q0gtmms-y3amkJoRws5bFeAmP6a9XmfuwXFOVshyby8dNHkiGlFq0ao-Uxe21RfBKosrEbiR7CT-5w',\n  'pSH5lRUAcE0Cqk-bKTlH0IYFZa8pfpXT6rQf8ybaRmnSJv0LNiCaXUeYqy6wJ36duvYDIl6u8lmzaA',\n  '3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ',\n  '81pnwBf13NcO4q0k2EdH-nE3NsjJnlrYXdiR1xnKmff2qs_cLz-D540Q-RjgrSa-dA4sbmsAq-JTjQ',\n  'XjEV9TRmLaQoRx4tBl99oztaP8rCOJxCTghiJBeoqGGi0Wcv7O2c-utaW_-t797QFW-xZg1iRMSamg',\n  '23prBqAyWrlkEK89A29ACLZ9pDKNxcIe5cR4SOdhmyyvtxwsU0O0k2SUnx2xzPcWgqh1IK8ltpk1qQ',\n  'UteRJTU3g1NP_67ENlqRpX8QhTO8OooBHF4S32bvEFutfaMeQQipmfmi1ExMTJCHos4glinM7ZJEWw',\n  'G-Lj_m6A3K4pvid9h6b-M9h17D5_-uhPA6HD4ujt78EIq1bx4Dga-Tyb4RujvvGk5cdZtvygp96vFA',\n  'M0j0ja9BC0OjyUg-MCF3YpdU3U-_SMpvTUq7Kxzh9GSvwil3RiBs6O50qGARFYnoiyr4zzsXtpsKIg',\n  'G5R1mdsETPnJNKub3tmpI7LqWchEp2dOao_coGZerFMjybtRwKk7ShHposUGWMk53y_F1b0WjCbPjA']}<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>info<\/strong>\" contains a lot of information about the game, such as when it was created, how long it lasted, etc.\nmatch_data&#91;'<strong>info<\/strong>'].keys()\ndict_keys(&#91;'endOfGameResult', 'gameCreation', 'gameDuration', 'gameEndTimestamp', 'gameId', 'gameMode', 'gameName', 'gameStartTimestamp', 'gameType', 'gameVersion', 'mapId', 'participants', 'platformId', 'queueId', 'teams', 'tournamentCode'])\n\n# We can see the duration of the game with \"<strong>gameDuration<\/strong>\":\nmatch_data&#91;'info']&#91;'gameDuration'] \/ 60 # \/ 60 to get it into minutes.\n<strong>30.483333333333334 # Minutes duration.<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Inside info, participants contains a list of length 10, each with more information about the player\nlen(match_data&#91;'info']&#91;'<strong>participants<\/strong>'])\n10 # <strong>participants<\/strong><\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Obtention de donn\u00e9es aupr\u00e8s d&rsquo;Im ONI :<\/mark><\/strong><\/p>\n\n\n\n<p>Nous prenons la liste des puuid de tous les participants et utilisons \u00ab\u00a0index\u00a0\u00bb pour savoir o\u00f9 se trouve notre joueur<strong> Im ON<\/strong>I.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># A list of all the participants puuids\nparticipants = match_data&#91;'metadata']&#91;'participants']\n# Now, find where in the data our players puuid is found\nplayer_index = participants.index(puuid)\nplayer_index\n<strong>2<\/strong><\/code><\/pre>\n\n\n\n<p>Il doit correspondre au puuid que nous utilisons pour rechercher les identifiants correspondants.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>participants&#91;player_index]\n'3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ'<\/code><\/pre>\n\n\n\n<p>V\u00e9rifions que cela fonctionne en utilisant cet index pour obtenir le nom des joueurs \u00e0 partir des donn\u00e9es.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># We verify the Summoner name we used in the first API ACCOUNT-V1\nmatch_data&#91;'info']&#91;'participants']&#91;player_index]&#91;'summonerName']\n'<strong>IIM ONI<\/strong>'\n\n# Now that we know where our player is, we can get his data\nplayer_data = match_data&#91;'info']&#91;'info']&#91;'participants']&#91;player_index]\n\nplayer_data&#91;'championName'] # Which Champion is playing with\n'<strong>Hwei<\/strong>'\n\n# We get his <strong>KDA<\/strong>\nk = player_data&#91;'kills']\nd = player_data&#91;'deaths']\na = player_data&#91;'assists']\nwin = player_data&#91;'win']\nprint(\"Kills:\", k)\nprint(\"Deaths:\", d)\nprint(\"Assists:\", a)\nprint(\"KDA:\", (k + a) \/ d)\nprint(\"Win:\", win)\n\n<strong>Kills: 10\nDeaths: 10\nAssists: 8\nKDA: 1.8\nWin: False<\/strong>\n\n# Let's get your role or position\nplayer_data&#91;'teamPosition']]\n'<strong>MIDDLE<\/strong>'<strong>\n<\/strong><\/code><\/pre>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-c9e9c1678e9400669e6e3c94da8980ac\"><strong>Exploration des donn\u00e9es sur les champions<\/strong><\/p>\n\n\n\n<p>Un autre aspect int\u00e9ressant a \u00e9t\u00e9 l&rsquo;exploration des donn\u00e9es sur les champions disponibles dans LoL. J&rsquo;ai consult\u00e9 des informations sur les statistiques de base, les comp\u00e9tences et bien plus encore, ce qui m&rsquo;a permis de mieux comprendre les forces et les faiblesses de chaque champion et leur impact sur le jeu.<\/p>\n\n\n\n<p>Nous avons utilis\u00e9 l&rsquo;API de ma\u00eetrise des champions \u00ab\u00a0<kbd>\/lol\/champion-mastery\/v4\/champion-masteries\/by-puuid\/{encryptedPUID}<\/kbd>\u00a0\u00bb qui renvoie le point de terminaison suivant :<\/p>\n\n\n\n<p>endpoint = \u00ab\u00a0https:\/\/euw1.api.riotgames.com\/lol\/champion-mastery\/v4\/champion-masteries\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ?api_key=RGAPI-6ee36def-3911-48e7-84e8-1234567890\u00a0\u00bb<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>res = requests.get(endpoint).json()\ndf_champs = pd.DataFrame(res)\ndf_champs<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/df_champ_oni.jpg\" alt=\"\" class=\"wp-image-1176\"\/><figcaption class=\"wp-element-caption\">Dataframe Champion Mastery<\/figcaption><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># We change the type of date with the Pandas datatime method and export the CSV with the production date.\ndf_champs&#91;'lastPlayTime'] = pd.to_datetime(df_champs&#91;'lastPlayTime'], unit = 'ms')\ndf_champs.to_csv(f'champs_mastery_{datetime.today().strftime(\"%Y_%m_%d\")}.csv', index = False)<\/code><\/pre>\n\n\n\n<p>Nous allons maintenant pouvoir analyser ce cadre de donn\u00e9es avec des s\u00e9ries temporelles dans Pandas.<\/p>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-6240e8f95ea4d2616c9a0f6bf9fa87c5\"><strong>Collecte de donn\u00e9es<\/strong><\/p>\n\n\n\n<p>Apprendre \u00e0 se connecter aux API, \u00e0 faire des requ\u00eates et \u00e0 obtenir des donn\u00e9es est un processus que j&rsquo;ai encore du mal \u00e0 comprendre \u00e0 plusieurs \u00e9gards. En fin de compte, notre objectif est de collecter autant de donn\u00e9es que possible \u00e0 partir de notre lecteur <strong>IM ONI<\/strong>, et bien que la courbe d&rsquo;apprentissage soit raide, la fa\u00e7on la plus rapide et la plus ordonn\u00e9e est de <strong>cr\u00e9er des fonctions<\/strong>. Pour comprendre la structure et l&rsquo;utilit\u00e9 de chaque <strong>fonction<\/strong>, j&rsquo;ai utilis\u00e9 les cha\u00eenes Youtube mentionn\u00e9es, des sites web de r\u00e9f\u00e9rence sur le contenu LOL, la documentation officielle du jeu et quelques exercices r\u00e9alis\u00e9s dans le cadre du parcours d&rsquo;apprentissage en Ing\u00e9nierie des donn\u00e9es avec Platzi.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Fonction #1 &#8211; Obtenir le PUUID d&rsquo;un joueur<\/mark><\/strong><\/p>\n\n\n\n<p>La premi\u00e8re fonction permet simplement d&rsquo;obtenir le puuid, en fonction du nom de l&rsquo;appelant et de la r\u00e9gion.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def <strong>get_puuid<\/strong>(summoner_name, region, api_key, mass_region):\n    api_url = (\n        \"https:\/\/\" + \n        mass_region +\n        \".api.riotgames.com\/riot\/account\/v1\/accounts\/by-riot-id\/\" +\n        summoner_name +\"\/\"+\n        region +\n        \"?api_key=\" +\n        api_key\n    )\n    \n    print(api_url)\n    resp = requests.get(api_url)\n    puuid = player_info&#91;'puuid']\n    return puuid<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>summoner_name = 'IIM%20ONI'\nmass_region = 'europe'\nregion = 'euw1'\n\npuuid_oni = get_puuid(summoner_name, region, api_key, mass_region)\npuuid_oni<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;europe.api.riotgames.com\/riot\/account\/v1\/accounts\/by-riot-id\/IIM%20ONI\/euw1?api_key=RGAPI-0f2ead89-123c-1234-1bd2-c123456789\n'<strong>3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ<\/strong>'<\/code><\/pre>\n\n\n\n<p>Ce que nous avons fait, c&rsquo;est construire l&rsquo;url de l&rsquo;API, effectuer la requ\u00eate et obtenir le PUUID. C&rsquo;est la m\u00eame chose que notre premi\u00e8re \u00e9tape, mais elle est maintenant modulaire et optimis\u00e9e.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Fonction #2 &#8211; Liste des identifiants des 20 derniers matches<\/mark><\/strong><\/p>\n\n\n\n<p>La fonction permettant d&rsquo;obtenir une liste de tous les ID de match (2\u00e8me exemple ci-dessus) \u00e0 partir d&rsquo;un <strong>puuid<\/strong> de joueur et de la <strong>mass_region<\/strong>.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def <strong>get_match_ids<\/strong>(puuid, mass_region, api_key):\n    api_url = (\n        \"https:\/\/\" +\n        mass_region +\n        \".api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/\" +\n        puuid + \n        \"\/ids?start=0&amp;count=20\" + \n        \"&amp;api_key=\" + \n        api_key\n    )\n    \n    print(api_url)\n    \n    resp = requests.get(api_url)\n    match_ids = resp.json()\n    return match_ids  <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># NOTE: region and mass_region are different.\n# for example, NA1 is the region of North America\n# which is part of the mass region AMERICAS\n# EUW1 is the Western Europe region, which is part of the mass region EUROPE\nmass_region = 'EUROPE\n\nmatch_ids = get_match_ids(puuid, mass_region, api_key)\nmatch_ids<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\"><a href=\"https:\/\/europe.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?start=0&amp;count=20&amp;api_key=RGAPI-0f2ead89-905c-4393-8bd6-c0112c330526\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/EUROPE.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?start=0&amp;count=20&amp;api_key=RGAPI-0f2ead89-905c-4393-8bd6-c0112c330526<\/a><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">['EUW1_6832340332',\n 'EUW1_6832299147',\n 'EUW1_6829175370',\n 'EUW1_6829148496',\n 'EUW1_6829025866',\n 'EUW1_6828945398',\n 'EUW1_6828887595',\n 'EUW1_6828867611',\n 'EUW1_6828812533',\n 'EUW1_6824214120',\n 'EUW1_6824173176',\n 'EUW1_6824124368',\n 'EUW1_6823607057',\n 'EUW1_6823569193',\n 'EUW1_6816330441',\n 'EUW1_6816300579',\n 'EUW1_6814475777',\n 'EUW1_6814449666',\n 'EUW1_6811931211',\n 'EUW1_6811890150']<\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Fonction # 3 &#8211; Donn\u00e9es du jeu<\/mark><\/strong><\/p>\n\n\n\n<p>\u00c0 partir d&rsquo;un identifiant de parti et d&rsquo;une r\u00e9gion de masse donn\u00e9s, obtenir les donn\u00e9es sur le parti.<\/p>\n\n\n\n<p>def <strong>get_match_data<\/strong>(match_id, mass_region, api_key):<br>api_url = (<br>\u00ab\u00a0https:\/\/\u00a0\u00bb +<br>mass_region +<br>\u00ab\u00a0.api.riotgames.com\/lol\/match\/v5\/matches\/\u00a0\u00bb +<br>match_id +<br>\u00ab\u00a0?api_key=\u00a0\u00bb +<br>api_key<br>)<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>resp = requests.get(api_url)\nmatch_data = resp.json()\nreturn match_data   <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>match_id = match_ids&#91;0]\nmatch_data = get_match_data(match_id, mass_region, api_key)\nmatch_data<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong># Recall that it returns 2823 lines of code, here are the first 20.\n<\/strong>{'metadata': {'dataVersion': '2',\n  'matchId': 'EUW1_6832340332',\n  'participants': &#91;'q0gtmms-y3amkJoRws5bFeAmP6a9XmfuwXFOVshyby8dNHkiGlFq0ao-Uxe21RfBKosrEbiR7CT-5w',\n   'pSH5lRUAcE0Cqk-bKTlH0IYFZa8pfpXT6rQf8ybaRmnSJv0LNiCaXUeYqy6wJ36duvYDIl6u8lmzaA',\n   '3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ',\n   '81pnwBf13NcO4q0k2EdH-nE3NsjJnlrYXdiR1xnKmff2qs_cLz-D540Q-RjgrSa-dA4sbmsAq-JTjQ',\n   'XjEV9TRmLaQoRx4tBl99oztaP8rCOJxCTghiJBeoqGGi0Wcv7O2c-utaW_-t797QFW-xZg1iRMSamg',\n   '23prBqAyWrlkEK89A29ACLZ9pDKNxcIe5cR4SOdhmyyvtxwsU0O0k2SUnx2xzPcWgqh1IK8ltpk1qQ',\n   'UteRJTU3g1NP_67ENlqRpX8QhTO8OooBHF4S32bvEFutfaMeQQipmfmi1ExMTJCHos4glinM7ZJEWw',\n   'G-Lj_m6A3K4pvid9h6b-M9h17D5_-uhPA6HD4ujt78EIq1bx4Dga-Tyb4RujvvGk5cdZtvygp96vFA',\n   'M0j0ja9BC0OjyUg-MCF3YpdU3U-_SMpvTUq7Kxzh9GSvwil3RiBs6O50qGARFYnoiyr4zzsXtpsKIg',\n   'G5R1mdsETPnJNKub3tmpI7LqWchEp2dOao_coGZerFMjybtRwKk7ShHposUGWMk53y_F1b0WjCbPjA']},\n 'info': {'endOfGameResult': 'GameComplete',\n  'gameCreation': 1708906756855,\n  'gameDuration': 1829,\n  'gameEndTimestamp': 1708908667752,\n  'gameId': 6832340332,\n  'gameMode': 'CLASSIC',\n  'gameName': 'teambuilder-match-6832340332',\n  'gameStartTimestamp': 1708906838802,\n  ....<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Fonction n\u00b0 4 &#8211; Donn\u00e9es du joueur sp\u00e9cifiques au jeu<\/mark><\/strong><\/p>\n\n\n\n<p>\u00c9tant donn\u00e9 les donn\u00e9es du match et un puuid de joueur, il renvoie uniquement les donn\u00e9es du joueur s\u00e9lectionn\u00e9.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def <strong>find_player_data<\/strong>(match_data, puuid):\n    participants = match_data&#91;'metadata']&#91;'participants']\n    player_index = participants.index(puuid)\n    player_data = match_data&#91;'info']&#91;'participants']&#91;player_index]\n    return player_data<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>find_player_data(match_data, puuid)<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-preformatted\">{'allInPings': 0,<br> 'assistMePings': 3,<br> 'assists': 8,<br> 'baronKills': 0,<br> 'basicPings': 0,<br> 'bountyLevel': 0,<br> 'challenges': {'12AssistStreakCount': 0,<br>  'abilityUses': 214,<br>  'acesBefore15Minutes': 0,<br>  'alliedJungleMonsterKills': 0,<br>  'baronTakedowns': 0,<br>  'blastConeOppositeOpponentCount': 0,<br>  'bountyGold': 825,<br>  'buffsStolen': 0,<br>  'completeSupportQuestInTime': 0,<br>  'controlWardTimeCoverageInRiverOrEnemyHalf': 0.1783287471126854,<br>  'controlWardsPlaced': 2,<br>  'damagePerMinute': 1012.4624544822548,<br>.....<\/pre>\n\n\n\n<p>Nous n&rsquo;avons rien fait de nouveau, nous avons simplement plac\u00e9 toutes les donn\u00e9es dans des fonctions afin de pouvoir les appeler plus facilement par la suite.<\/p>\n\n\n\n<p>Supposons maintenant que nous voulions regarder nos 20 derniers matchs et en extraire les donn\u00e9es. Pour ce faire, il suffit de parcourir en boucle la liste des identifiants de match et d&rsquo;ex\u00e9cuter les fonctions. Dans mon exemple, nous enregistrerons \u00e0 chaque fois des informations sur le champion, le <strong>KDA<\/strong> et les r\u00e9sultats.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># We initialise an empty dictionary to store data for each game\ndata = {\n    'champion': &#91;],\n    'kills': &#91;],\n    'deaths': &#91;],\n    'assists': &#91;],\n    'win': &#91;]\n}\n\nfor match_id in match_ids:\n    print(match_id)\n    \n    # run the two functions to get the player data from the match ID\n    match_data = get_match_data(match_id, mass_region, api_key)\n    player_data = find_player_data(match_data, puuid)\n    \n    # assign the variables we're interested in\n    champion = player_data&#91;'championName']\n    k = player_data&#91;'kills']\n    d = player_data&#91;'deaths']\n    a = player_data&#91;'assists']\n    win = player_data&#91;'win']\n     \n    # add them to our dataset\n    data&#91;'champion'].append(champion)\n    data&#91;'kills'].append(k)\n    data&#91;'deaths'].append(d)\n    data&#91;'assists'].append(a)\n    data&#91;'win'].append(win)  <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>EUW1_6832340332\nEUW1_6832299147\nEUW1_6829175370\nEUW1_6829148496\nEUW1_6829025866\nEUW1_6828945398\nEUW1_6828887595\nEUW1_6828867611\nEUW1_6828812533\nEUW1_6824214120\nEUW1_6824173176\nEUW1_6824124368\nEUW1_6823607057\nEUW1_6823569193\nEUW1_6816330441\nEUW1_6816300579\nEUW1_6814475777\nEUW1_6814449666\nEUW1_6811931211\nEUW1_6811890150<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code># Data on the last 20 games of the account in question\n<strong>data<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>{'champion': &#91;'Hwei',\n  'LeeSin',\n  'Swain',\n  'Gnar',\n  'Lux',\n  'Pyke',\n  'Kindred',\n  'Lucian',\n  'Ezreal',\n  'Yasuo',\n  'Talon',\n  'Qiyana',\n  'TwistedFate',\n  'Sylas',\n  'Talon',\n  'TwistedFate',\n  'Briar',\n  'Hwei',\n  'Zed',\n  'Rengar'],\n 'kills': &#91;10, 13, 12, 14, 6, 9, 5, 0, 8, 5, 7, 7, 3, 9, 11, 7, 6, 6, 10, 10],\n 'deaths': &#91;10,\n  11,\n  7,\n  4,\n  14,\n  10,\n  8,\n  0,\n  0,\n  9,\n  2,\n  13,\n  7,\n  9,\n  4,\n  9,\n  17,\n  11,\n  13,\n  10],\n 'assists': &#91;8,\n  11,\n  13,\n  13,\n  12,\n  4,\n  5,\n  0,\n  8,\n  10,\n  4,\n  9,\n  8,\n  9,\n  3,\n  6,\n  14,\n  13,\n  10,\n  10],\n 'win': &#91;False,\n  False,\n  True,\n  True,\n  False,\n  False,\n  False,\n  True,\n  True,\n  False,\n  True,\n  False,\n  True,\n  True,\n  True,\n  False,\n  False,\n  False,\n  True,\n  False]}<\/code><\/pre>\n\n\n\n<p>Pour une meilleure lecture, nous allons convertir notre dictionnaire de donn\u00e9es en DataFrame.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df = pd.DataFrame(data)\ndf<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/20_matches-558x1024.jpg\" alt=\"\" class=\"wp-image-1180\" style=\"width:263px;height:auto\"\/><\/figure>\n\n\n\n<p>Nous allons \u00e9galement convertir le code ci-dessus en une fonction pour une utilisation ult\u00e9rieure.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def <strong>gather_all_data<\/strong>(puuid, match_ids, mass_region, api_key):\n    # We initialise an empty dictionary to store data for each game\n    data = {\n        'champion': &#91;],\n        'kills': &#91;],\n        'deaths': &#91;],\n        'assists': &#91;],\n        'win': &#91;]\n    }\n\n    for match_id in match_ids:\n        print(match_id)\n\n        # run the two functions to get the player data from the match ID\n        match_data = get_match_data(match_id, mass_region, api_key)\n        player_data = find_player_data(match_data, puuid)\n\n        # assign the variables we're interested in\n        champion = player_data&#91;'championName']\n        k = player_data&#91;'kills']\n        d = player_data&#91;'deaths']\n        a = player_data&#91;'assists']\n        win = player_data&#91;'win']\n\n        # add them to our dataset\n        data&#91;'champion'].append(champion)\n        data&#91;'kills'].append(k)\n        data&#91;'deaths'].append(d)\n        data&#91;'assists'].append(a)\n        data&#91;'win'].append(win)    \n    \n    df = pd.DataFrame(data)\n    \n    return df<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>df = <strong>gather_all_data<\/strong>(puuid, match_ids, mass_region, api_key)\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>EUW1_6832340332\nEUW1_6832299147\nEUW1_6829175370\nEUW1_6829148496\nEUW1_6829025866\nEUW1_6828945398\nEUW1_6828887595\nEUW1_6828867611\nEUW1_6828812533\nEUW1_6824214120\nEUW1_6824173176\nEUW1_6824124368\nEUW1_6823607057\nEUW1_6823569193\nEUW1_6816330441\nEUW1_6816300579\nEUW1_6814475777\nEUW1_6814449666\nEUW1_6811931211\nEUW1_6811890150<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>df<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/20_matches-558x1024.jpg\" alt=\"\" class=\"wp-image-1180\" style=\"width:263px;height:auto\"\/><\/figure>\n\n\n\n<p>Comme vous pouvez le constater, la colonne \u00ab\u00a0win\u00a0\u00bb est un bool\u00e9en (vrai ou faux).<br>Pour plus de facilit\u00e9, nous allons la convertir en un int (1 ou 0).<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>df&#91;'win'] = df&#91;'win'].astype(int)\n<strong>df<\/strong><\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/20_matches_cast-544x1024.jpg\" alt=\"\" class=\"wp-image-1181\" style=\"width:251px;height:auto\"\/><\/figure>\n\n\n\n<p>Maintenant que nous l&rsquo;avons sous forme de DataFrame, il est beaucoup plus facile de faire ce que nous voulons, par exemple :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong># Searching for averages\n<\/strong>df.mean(numeric_only=True) # numeric_only prevents it from trying to calculate the average of the \"champion\" column.<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>kills      7.90\ndeaths     8.40\nassists    8.50\nwin        0.45\ndtype: float64<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong># Get averages per champion\n<\/strong>df.groupby('champion').mean()<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/mean_champions-588x1024.jpg\" alt=\"\" class=\"wp-image-1182\" style=\"width:266px;height:auto\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code><strong># sort your games by number of kills\n<\/strong>df.sort_values('kills')<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-large is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/sortvalues_kills-561x1024.jpg\" alt=\"\" class=\"wp-image-1183\" style=\"width:257px;height:auto\"\/><\/figure>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Ajouter des arguments aux appels d&rsquo;API<\/mark><\/strong><\/p>\n\n\n\n<p>20 jeux n&rsquo;est pas vraiment suffisant pour \u00e9valuer un compte, alors retournons \u00e0 l&rsquo;une de nos fonctions et ajoutons quelques arguments.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># The original function\ndef <strong>get_match_ids<\/strong>(puuid, mass_region, api_key):\n    api_url = (\n        \"https:\/\/\" +\n        mass_region +\n        \".api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/\" +\n        puuid + \n        \"\/ids?start=0&amp;count=20\" + \n        \"&amp;api_key=\" + \n        api_key\n    )\n    \n    print(api_url)\n    \n    resp = requests.get(api_url)\n    match_ids = resp.json()\n    return match_ids <\/code><\/pre>\n\n\n\n<p>Comme vous pouvez le voir dans la fonction originale, il y a d\u00e9j\u00e0 un argument pour \u00ab\u00a0count=20\u00a0\u00bb, donc tout ce que nous avons \u00e0 faire est de le remplacer par une variable de notre choix.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>Updated function<\/strong> where you can set how many games you want to play\ndef <strong>get_match_ids<\/strong>(puuid, mass_region, no_games, api_key):\n    api_url = (\n        \"https:\/\/\" +\n        mass_region +\n        \".api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/\" +\n        puuid + \n        \"\/ids?start=0\" + \n        \"&amp;count=\" +\n        str(no_games) + \n        \"&amp;api_key=\" + \n        api_key\n    )\n    \n    print(api_url)\n    \n    resp = requests.get(api_url)\n    match_ids = resp.json()\n    return match_ids<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>no_games = 25 # Leave it at 25 for now\n\nmatch_ids = get_match_ids(puuid, mass_region, no_games, api_key)\n\nprint(len(match_ids))<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;EUROPE.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?start=0&amp;count=25&amp;api_key=RGAPI-0f2ead89-905c-4393-8bd6-c0123456789\n<strong>25<\/strong><\/code><\/pre>\n\n\n\n<p>Mais si nous ne voulons que les donn\u00e9es d&rsquo;un certain type de file d&rsquo;attente (j&rsquo;utiliserai les solos classifi\u00e9s), comment savoir quel argument utiliser ?<\/p>\n\n\n\n<p>Retournez sur le portail, revenez \u00e0 MATCH-V5 (\u00e0 gauche) et rouvrez \u00ab\u00a0<kbd>\/lol\/match\/v5\/matches\/by-puuid\/{puuid}\/ids<\/kbd>\u00ab\u00a0.<\/p>\n\n\n\n<p>Descendez jusqu&rsquo;en bas et remplissez \u00e0 nouveau le formulaire avec le m\u00eame puuid, la m\u00eame r\u00e9gion et la m\u00eame application. Sauf que cette fois-ci, ajoutez \u00e9galement \u00ab\u00a0420\u00a0\u00bb \u00e0 l&rsquo;entr\u00e9e \u00ab\u00a0queue\u00a0\u00bb puis EXECUTE REQUEST<\/p>\n\n\n\n<p>Copiez et collez l&rsquo;URL de la demande :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>'https:\/\/europe.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?queue=420&amp;start=0&amp;count=20&amp;api_key=RGAPI-552af7d9-284b-42d1-bec4-123456789'<\/code><\/pre>\n\n\n\n<p>Comme vous pouvez le voir, il y a un nouvel argument : \u00ab\u00a0queue=420\u00a0\u00bb.<\/p>\n\n\n\n<p>Si vous vous demandez o\u00f9 trouver tous les types de file d&rsquo;attente, vous pouvez aller ici : <a href=\"https:\/\/static.developer.riotgames.com\/docs\/lol\/queues.json\">https:\/\/static.developer.riotgames.com\/docs\/lol\/queues.json<\/a><\/p>\n\n\n\n<p>Recherchez simplement le type de file d&rsquo;attente que vous souhaitez dans la description et remplacez \u00ab\u00a0queue\u00a0\u00bb par l&rsquo;identifiant de la file d&rsquo;attente.<\/p>\n\n\n\n<p>Ajoutons ceci \u00e0 notre fonction<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># <strong>Updated function<\/strong> in which you can set from which queue to take the data.\ndef get_match_ids(puuid, mass_region, no_games, queue_id, api_key):\n    api_url = (\n        \"https:\/\/\" +\n        mass_region +\n        \".api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/\" +\n        puuid + \n        \"\/ids?start=0\" + \n        \"&amp;count=\" +\n        str(no_games) + \n        \"&amp;queue=\" + \n        str(queue_id) + \n        \"&amp;api_key=\" + \n        api_key\n    )\n    \n    print(api_url)\n    \n    resp = requests.get(api_url)\n    match_ids = resp.json()\n    return match_ids  <\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>queue_id = 420\n\nmatch_ids = get_match_ids(puuid, mass_region, no_games, queue_id, api_key)\n<strong>match_ids<\/strong><\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>https:&#47;&#47;EUROPE.api.riotgames.com\/lol\/match\/v5\/matches\/by-puuid\/3U7K7AmFQldQCNlJ9m5OwFRhrIrJ6ZsVMpdhS9HDoTj7BlUsjYDTcVeZnYdU8dMudHzxT5yspRkNkQ\/ids?start=0&amp;count=25&amp;queue=420&amp;api_key=RGAPI-0f2ead89-905c-4393-8bd6-c0123456789\n&#91;'EUW1_6832340332',\n 'EUW1_6832299147',\n 'EUW1_6829025866',\n 'EUW1_6828945398',\n 'EUW1_6828887595',\n 'EUW1_6828867611',\n 'EUW1_6828812533',\n 'EUW1_6824214120',\n 'EUW1_6824173176',\n 'EUW1_6824124368',\n 'EUW1_6823607057',\n 'EUW1_6823569193',\n 'EUW1_6816330441',\n 'EUW1_6816300579',\n 'EUW1_6811931211',\n 'EUW1_6811890150',\n 'EUW1_6811856975',\n 'EUW1_6811833682',\n 'EUW1_6811806415',\n 'EUW1_6811800693',\n 'EUW1_6811586364',\n 'EUW1_6811555500',\n 'EUW1_6811498704',\n 'EUW1_6809947413',\n 'EUW1_6809911341']<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Mettons \u00e0 jour la derni\u00e8re fonction pour qu&rsquo;elle corresponde \u00e0 la limite de vitesse.<\/mark><\/strong><\/p>\n\n\n\n<p>Il y a une limite pour les requ\u00eates API sur Riot Games, actuellement elle est fix\u00e9e \u00e0 20 requ\u00eates par seconde et 100 par 2 minutes. Le nombre maximum de jeux r\u00e9cents pouvant \u00eatre demand\u00e9s est donc de 100. Que se passe-t-il si nous en demandons plus ? Il renvoie simplement une erreur 429 (Rate limit exceeded), ce qui signifie que nous avons d\u00e9pass\u00e9 notre limite de demande.<\/p>\n\n\n\n<p>\u00c9tendons donc la demande \u00e0 100 jeux.<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># Original function to obtain the party ID\ndef get_match_data(match_id, mass_region, api_key):\n    api_url = (\n        \"https:\/\/\" + \n        mass_region + \n        \".api.riotgames.com\/lol\/match\/v5\/matches\/\" +\n        match_id + \n        \"?api_key=\" + \n        api_key\n    )\n    \n    resp = requests.get(api_url)\n    print(\"Status Code:\", resp.status_code) # We can read the status code directly from the object \"resp\".\n    match_data = resp.json()\n    return match_data     <\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nous allons cr\u00e9er une fonction principale pour conclure le tout<\/mark><\/strong><\/p>\n\n\n\n<p>Nous pouvons regrouper toutes nos fonctions en une seule :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>def <strong>master_function<\/strong>(summoner_name, region, mass_region, no_games, queue_id, api_key):\n    puuid = get_puuid(summoner_name, region, api_key, mass_region)\n    match_ids = get_match_ids(puuid, mass_region, no_games, queue_id, api_key)\n    df = gather_all_data(puuid, match_ids, mass_region, api_key)\n    return df<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>summoner_name = \"IIM ONI\"\nregion = \"euw1\"\nmass_region = \"EUROPE\"\nno_games = 100\nqueue_id = 420<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>df = master_function(summoner_name, region, mass_region, no_games, queue_id, api_key)<\/code><\/pre>\n\n\n\n<p>Maintenant que nous disposons d&rsquo;une fonction qui renvoie les donn\u00e9es de 100 jeux, nous pouvons automatiser un peu les choses en imprimant certaines informations :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code># prints some introductory stuff\nprint(\"Hello\", summoner_name, \"of\", region.upper()) # upper just capitalizes the region\nprint(\"Here are some interesting statistics about your last 100 solo ranked games\")\n\n# create a count column\ndf&#91;'count'] = 1 \n\n# the \"agg\" allows us to get the average of each column but adding up the count # see?\nchamp_df = df.groupby('champion').agg({'kills': 'mean', 'deaths': 'mean', 'assists': 'mean', 'win': 'mean', 'count': 'sum'})\n\n# reset in the index to be able to continue using the \"champ\" column\nchamp_df.reset_index(inplace=True)\n\n# we limit it only to champions in which you have played 2 or more matches\nchamp_df = champ_df&#91;champ_df&#91;'count'] &gt;= 2]\n\n# create a kda column\nchamp_df&#91;'kda'] = (champ_df&#91;'kills'] + champ_df&#91;'assists']) \/ champ_df&#91;'deaths']\n\n# sort the table by KDA, starting with the highest one\nchamp_df = champ_df.sort_values('kda', ascending=False) # ascendente determina si es de mayor a menor o viceversa\n\n# assign the first row and the last row to a variable in order to print information about it\nbest_row = champ_df.iloc&#91;0] # .iloc&#91;0] simply takes the first row of the data frame\nworst_row = champ_df.iloc&#91;-1] # .iloc&#91;-1] takes the last row of a data frame\n\nprint(\"Your best KDA is on\", best_row&#91;'champion'], \"with a KDA of\", best_row&#91;'kda'], \"over\", best_row&#91;'count'], \"game\/s\")\nprint(\"Your worst KDA is on\", worst_row&#91;'champion'], \"with a KDA of\", worst_row&#91;'kda'], \"over\", worst_row&#91;'count'], \"game\/s\")\n\n# sort by count\nchamp_df = champ_df.sort_values('count', ascending=False)\n\n# get your most played champ\nrow = champ_df.iloc&#91;0]\n\n# assign and format the win rate\nwin_rate = row&#91;'win']]\nwin_rate = str(round(round(win_rate * 100, 1)) + \"%\"\n\nprint(\"Your highest played Champion is\", row&#91;'champion'], \"with\", row&#91;'count'], 'game\/s', \n     \"and an average Win Rate of\", win_rate)\n\n# finally, sort by the highest number of kills in a game (note, not using the champ_df groupby anymore, but the raw data)\nhighest_kills = df.sort_values('kills', ascending=False)\nrow = highest_kills.iloc&#91;0]\nprint(\"Your highest kill game was with\", row&#91;'champion'], \"where you had\", row&#91;'kills'], \"kills\")<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>Hello IIM ONI of EUW1\nHere are some interesting statistics about your last 100 solo ranked games\nYour best KDA is on Renata with a KDA of 5.833333333333333 over 2 game\/s\nYour worst KDA is on Pyke with a KDA of 1.5 over 2 game\/s\nYour highest played Champion is Yasuo with 11 game\/s and an average Win Rate of 72.7%\nYour highest kill game was with Caitlyn where you had 19 kills<\/strong><\/code><\/pre>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-9c0229ecd31856d1abaa698e8a6c5d62\"><strong>Visualisation de donn\u00e9es avec Python<\/strong><\/p>\n\n\n\n<p>\u00c0 l&rsquo;aide d&rsquo;outils tels que Pandas, Matplotlib et Seaborn, j&rsquo;ai cr\u00e9\u00e9 des visualisations montrant des tendances, des statistiques et des sch\u00e9mas int\u00e9ressants dans les donn\u00e9es du jeu. Ces visualisations m&rsquo;ont permis de partager efficacement mes r\u00e9sultats et de mieux comprendre le monde de LoL.<\/p>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre de matchs jou\u00e9s par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/1.png\" alt=\"\" class=\"wp-image-1188\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the number of games played with each champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='count', estimator=sum, palette='viridis')\nplt.title('Number of Games Played per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Number of Games')\nplt.xticks(rotation=45)\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Relation entre les tu\u00e9s et les morts<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/2.png\" alt=\"\" class=\"wp-image-1189\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Scatter plot to show the relationship between kills and deaths\nplt.figure(figsize=(8, 6))\nsns.scatterplot(data=champ_df, x='kills', y='deaths', color='red', alpha=0.5)\nplt.title('Relationship between Kills and Deaths')\nplt.xlabel('Kills')\nplt.ylabel('Deaths')\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre moyen de passes d\u00e9cisives par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/3.png\" alt=\"\" class=\"wp-image-1190\" style=\"width:840px;height:auto\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the average assists per champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='assists', estimator='mean', palette='magma')\nplt.title('Average Assists per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Average Assists')\nplt.xticks(rotation=45)\nplt.show()\n<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Distribution des KDA (Killings + Assists \/ Deaths)<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/4.png\" alt=\"\" class=\"wp-image-1191\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Histogram to show the distribution of KDA (Kills + Assists \/ Deaths)\nplt.figure(figsize=(8, 6))\nsns.histplot(data=champ_df, x='kda', bins=20, color='purple', kde=True)\nplt.title('Distribution of KDA')\nplt.xlabel('KDA')\nplt.ylabel('Number of Games')\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre de morts par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/5.png\" alt=\"\" class=\"wp-image-1192\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the total number of kills per champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='kills', estimator=sum, palette='cool')\nplt.title('Total Number of Kills per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Number of Kills')\nplt.xticks(rotation=45)\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre de d\u00e9c\u00e8s par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/6.png\" alt=\"\" class=\"wp-image-1193\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the total number of deaths per champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='deaths', estimator=sum, palette='flare')\nplt.title('Total Number of Deaths per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Number of Deaths')\nplt.xticks(rotation=45)\nplt.show()\n<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre de passes d\u00e9cisives par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/7.png\" alt=\"\" class=\"wp-image-1194\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the total number of assists per champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='assists', estimator=sum, palette='rocket')\nplt.title('Total Number of Assists per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Number of Assists')\nplt.xticks(rotation=45)\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Nombre de matchs gagn\u00e9s et perdus par le champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/8.png\" alt=\"\" class=\"wp-image-1195\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Bar plot to show the number of games won and lost per champion\nplt.figure(figsize=(10, 6))\nsns.barplot(data=champ_df, x='champion', y='count', hue='win', estimator=sum, palette='husl')\nplt.title('Number of Games Won and Lost per Champion')\nplt.xlabel('Champion')\nplt.ylabel('Number of Games')\nplt.xticks(rotation=45)\nplt.legend(title='Outcome')\nplt.show()<\/code><\/pre>\n\n\n\n<p><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">R\u00e9partition des KDA par champion<\/mark><\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" src=\"https:\/\/javierladino.com\/es\/wp-content\/uploads\/2024\/05\/9.png\" alt=\"\" class=\"wp-image-1196\"\/><\/figure>\n\n\n\n<pre class=\"wp-block-code\"><code># Box plot to show the distribution of KDA per champion\nplt.figure(figsize=(10, 6))\nsns.boxplot(data=champ_df, x='champion', y='kda', palette='pastel')\nplt.title('Distribution of KDA per Champion')\nplt.xlabel('Champion')\nplt.ylabel('KDA')\nplt.xticks(rotation=45)\nplt.show()<\/code><\/pre>\n\n\n\n<p class=\"has-vivid-purple-color has-text-color has-link-color has-large-font-size wp-elements-36da64fe9bae46ebcc1a417e7fb2b355\"><strong>Conclusion<\/strong><\/p>\n\n\n\n<p>Mon parcours de fan d&rsquo;<strong>IM ONI<\/strong> \u00e0 professionnel de la <strong>science des donn\u00e9es et de l&rsquo;ing\u00e9nierie<\/strong> ne fait que commencer, mais il a \u00e9t\u00e9 passionnant et gratifiant jour apr\u00e8s jour. Gr\u00e2ce \u00e0 l&rsquo;analyse et \u00e0 la visualisation des donn\u00e9es de League of Legends, j&rsquo;ai pu combiner ma passion pour les jeux vid\u00e9o avec mes comp\u00e9tences techniques nouvellement acquises. Ce voyage a non seulement \u00e9largi ma compr\u00e9hension du jeu, mais a \u00e9galement d\u00e9montr\u00e9 la puissance et la polyvalence de la science des donn\u00e9es dans divers domaines d&rsquo;int\u00e9r\u00eat. Je suis enthousiaste \u00e0 l&rsquo;id\u00e9e de continuer \u00e0 explorer et \u00e0 apprendre dans ce domaine passionnant, et j&rsquo;ai h\u00e2te de partager mes d\u00e9couvertes avec vous \u00e0 l&rsquo;avenir. Merci de m&rsquo;avoir accompagn\u00e9 dans cette aventure !<\/p>\n\n\n\n<p class=\"has-large-font-size\"><strong><mark style=\"background-color:rgba(0, 0, 0, 0)\" class=\"has-inline-color has-vivid-cyan-blue-color\">Sources et ressources<\/mark><\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/@CodinEric\" target=\"_blank\" rel=\"noreferrer noopener\">CodinEric &#8211; Youtube<\/a><kbd><strong> <\/strong><\/kbd><\/p>\n\n\n\n<p><a href=\"https:\/\/www.youtube.com\/@itero_gaming\" target=\"_blank\" rel=\"noreferrer noopener\">Jack J &#8211; iTero Gaming &#8211; Youtube<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/www.riotgames.com\/en\/DevRel\/summoner-names-to-riot-id\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/www.riotgames.com\/en\/DevRel\/summoner-names-to-riot-id<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/developer.riotgames.com\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/developer.riotgames.com<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/support-leagueoflegends.riotgames.com\/hc\/es-419\/articles\/4406004330643-Niveles-de-clasificatoria-divisiones-y-colas\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/support-leagueoflegends.riotgames.com\/hc\/es-419\/articles\/4406004330643-Niveles-de-clasificatoria-divisiones-y-colas<\/a><\/p>\n\n\n\n<p><a href=\"https:\/\/darkintaqt.com\/blog\/ids\" target=\"_blank\" rel=\"noreferrer noopener\">https:\/\/darkintaqt.com\/blog\/ids<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bonjour, je partage avec vous ce parcours personnel, en tant que fan d&rsquo;un grand joueur de League of Legends (LoL) appel\u00e9 IM ONI, et comment \u00e0 travers les donn\u00e9es que le jeu offre, j&rsquo;ai lentement r\u00e9ussi \u00e0 avancer dans ma reconversion professionnelle vers la Data Science et l&rsquo;Ing\u00e9nierie des Donn\u00e9es. Dans ce billet, je vais &hellip; <\/p>\n","protected":false},"author":1,"featured_media":1039,"comment_status":"closed","ping_status":"closed","template":"","meta":{"ngg_post_thumbnail":0},"rara_portfolio_categories":[27],"class_list":["post-1038","rara-portfolio","type-rara-portfolio","status-publish","has-post-thumbnail","hentry","rara_portfolio_categories-dataviz"],"_links":{"self":[{"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/rara-portfolio\/1038","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/rara-portfolio"}],"about":[{"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/types\/rara-portfolio"}],"author":[{"embeddable":true,"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/comments?post=1038"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/media\/1039"}],"wp:attachment":[{"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/media?parent=1038"}],"wp:term":[{"taxonomy":"rara_portfolio_categories","embeddable":true,"href":"https:\/\/javierladino.com\/fr\/wp-json\/wp\/v2\/rara_portfolio_categories?post=1038"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}