Advertisement
Guest User

Pb python

a guest
Jan 29th, 2020
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. final_output = []
  2. game_data = {}
  3. for game in matches_response:
  4. participantId = getParticipantId(player, matches_response[game])
  5.  
  6. championName = getChampionName(participantId, game, crd)
  7. game_data['ChampionName'] = championName
  8.  
  9. result = getResult(participantId, game)
  10. game_data['result'] = result
  11.  
  12. side = getSide(participantId, game)
  13. game_data['side'] = side
  14.  
  15. gameDuration = getGameDuration(game)
  16. game_data['gameDuration'] = gameDuration
  17.  
  18. kda = getKDA(participantId, game)
  19. game_data['kills'] = kda[0]
  20. game_data['death'] = kda[1]
  21. game_data['assist'] = kda[2]
  22.  
  23. cs = getCS(participantId, game)
  24. totalCS = str(cs[0]) + ' (' + str(cs[1]) + ')'
  25.  
  26. game_data['cs'] = totalCS
  27. goldEarned = getGoldEarned(participantId, game)
  28.  
  29. game_data['goldEarned'] = goldEarned
  30. damages = getDamageToChamps(participantId, game, side)
  31.  
  32. totalDamageToChamps = str(damages[0]) + ' (' + str(damages[1]) + '%)'
  33. game_data['totalDamageToChamps'] = totalDamageToChamps
  34.  
  35. bans = getBans(side, game, crd)
  36. game_data['banTeam1'] = bans[0][0]
  37. game_data['banTeam2'] = bans[0][1]
  38. game_data['banTeam3'] = bans[0][2]
  39. game_data['banTeam4'] = bans[0][3]
  40. game_data['banTeam5'] = bans[0][4]
  41. game_data['banOpponent1'] = bans[1][0]
  42. game_data['banOpponent2'] = bans[1][1]
  43. game_data['banOpponent3'] = bans[1][2]
  44. game_data['banOpponent4'] = bans[1][3]
  45. game_data['banOpponent5'] = bans[1][4]
  46.  
  47. teamComp = getTeamComps(side, game, crd)
  48. game_data['blueChampTop'] = teamComp[0]['Top']
  49. game_data['blueChampJgl'] = teamComp[0]['Jgl']
  50. game_data['blueChampMid'] = teamComp[0]['Mid']
  51. game_data['blueChampAdc'] = teamComp[0]['Adc']
  52. game_data['blueChampSupp'] = teamComp[0]['Supp']
  53. game_data['redChampTop'] = teamComp[1]['Top']
  54. game_data['redChampJgl'] = teamComp[1]['Jgl']
  55. game_data['redChampMid'] = teamComp[1]['Mid']
  56. game_data['redChampAdc'] = teamComp[1]['Adc']
  57. game_data['redChampSupp'] = teamComp[1]['Supp']
  58.  
  59. visionScore = getVisionScore(participantId, game)
  60. game_data['visionScore'] = visionScore['VisionScore']
  61. game_data['wardsPlaced'] = visionScore['Wards Placed']
  62. game_data['wardsKilled'] = visionScore['Wards Killed']
  63. game_data['pinkWards'] = visionScore['Pink Wards']
  64.  
  65. turretKilled = getTurretKills(participantId, game)
  66. game_data['turretKilled'] = turretKilled
  67.  
  68. firstBlood = firstBlood(participantId, game)
  69. game_data['firstBloodKill'] = firstBlood['firstBloodKill']
  70. game_data['firstBloodAssist'] = firstBlood['firstBloodAssist']
  71.  
  72. firstTurret = firstTurret(participantId, game)
  73. game_data['firstTurretKill'] = firstBlood['firstTurretKill']
  74. game_data['firstTurretAssist'] = firstBlood['firstTurretAssist']
  75.  
  76. firstInhib = firstInhib(participantId, game)
  77. game_data['firstInhibKill'] = firstBlood['firstInhibKill']
  78. game_data['firstInhibAssist'] = firstBlood['firstInhibAssist']
  79.  
  80. runes = getRunes(participantId, game, runeRawData)
  81. game_data['runePrincipal'] = runes['runePrincipal']
  82. game_data['rune1'] = runes['rune1']
  83. game_data['rune2'] = runes['rune2']
  84. game_data['rune3'] = runes['rune3']
  85. game_data['runeSecondaire1'] = runes['rune4']
  86. game_data['runeSecondaire2'] = runes['rune5']
  87.  
  88. items = getItems(participantId, game, ird)
  89. game_data['items'] = items
  90.  
  91. summoners = getSummonerSpells(participantId, game, srd)
  92. game_data['summoner1'] = summoners['summoner 1']
  93. game_data['summoner2'] = summoners['summoner 2']
  94.  
  95. match_timeline_response = []
  96. match_timeline_response = api.get_timeline(game['gameId'])
  97. request_number += 1
  98. if request_number % 20 == 0:
  99. time.sleep(2)
  100. if request_number % 100 == 0:
  101. time.sleep(120)
  102.  
  103. positions = getPositions(participantId, game)
  104. game_data['position @ 0'] = positions['position0']
  105. game_data['position @ 1'] = positions['position1']
  106. game_data['position @ 2'] = positions['position2']
  107. game_data['position @ 3'] = positions['position3']
  108.  
  109. final_output.append(game_data)
  110.  
  111. df = pd.DataFrame(final_output)
  112. df.head(51)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement