Ejemplo n.º 1
0
 def get5Performances(self):
     self.performances.append(
         playerdashboardbylastngames.PlayerDashboardByLastNGames(
             self.id, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N",
             "2014-15",
             "Regular Season").last5_player_dashboard.get_dict().get('data')
         [0][28])
     self.performances.append(
         playerdashboardbylastngames.PlayerDashboardByLastNGames(
             self.id, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N",
             "2015-16",
             "Regular Season").last5_player_dashboard.get_dict().get('data')
         [0][28])
     self.performances.append(
         playerdashboardbylastngames.PlayerDashboardByLastNGames(
             self.id, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N",
             "2016-17",
             "Regular Season").last5_player_dashboard.get_dict().get('data')
         [0][28])
     self.performances.append(
         playerdashboardbylastngames.PlayerDashboardByLastNGames(
             self.id, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N",
             "2017-18",
             "Regular Season").last5_player_dashboard.get_dict().get('data')
         [0][28])
     self.performances.append(
         playerdashboardbylastngames.PlayerDashboardByLastNGames(
             self.id, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N",
             "2018-19",
             "Regular Season").last5_player_dashboard.get_dict().get('data')
         [0][28])
Ejemplo n.º 2
0
    def get_player_stat(self):
        stats = playerdashboardbylastngames.PlayerDashboardByLastNGames(
            player_id=self.player_id,
            season="2019-20",
            date_to_nullable="03/09/2020"
        )

        return {
            "last5": stats.last5_player_dashboard.get_json(),
            "last10": stats.last10_player_dashboard.get_json(),
            "last15": stats.last15_player_dashboard.get_json(),
            "last20": stats.last20_player_dashboard.get_json(),
        }
Ejemplo n.º 3
0
career = playercareerstats.PlayerCareerStats(player_id='203076')
ad = career.get_data_frames()[0]

import pandas as pd

type(ad)
ad.columns
ad.FG3_PCT.mean()
ad.FT_PCT.mean()

ad_games = PlayerDashboardByGameSplits(player_id='203076',
                                       date_from_nullable='10-20-2016')

ad_log = ad_games.get_data_frames()[0]
ad_log

ad_time = playerdashboardbyyearoveryear.PlayerDashboardByYearOverYear(
    player_id='203076')
ad_time.get_data_frames()[0]

ad_last_20 = playerdashboardbylastngames.PlayerDashboardByLastNGames(
    player_id='203076', last_n_games=20)

ad_last_20.get_data_frames()[0]
ad_2016_game_log = PlayerGameLog(player_id='203076',
                                 season=2016).get_data_frames()[0]

ad_2016_game_log.head()

nba.BoxScoreDefensive(game_id='0021900475').get_data_frames()[0].columns
Ejemplo n.º 4
0
from nba_api.stats.endpoints import commonplayerinfo
from nba_api.stats.endpoints import playerdashboardbylastngames
from nba_api.stats.static import players

player_info = commonplayerinfo.CommonPlayerInfo(2544, "00")
lebron_dict = player_info.common_player_info.get_dict()
# lebron_log = playergamelog.PlayerGameLog(2544, 2017-18, "Regular Season")
# print(lebron_log)
lebron_last_5_games = playerdashboardbylastngames.PlayerDashboardByLastNGames(2544, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N", "2017-18", "Regular Season")
#lebron_last_5_games_2 = playerdashboardbylastngames.PlayerDashboardByLastNGames(2544, 0, "Base", 0, 0, "N", "PerGame", 0, "N", "N", "2017-18", "Regular Season", "03-20-2018", "03-10-2018")
lebron_5_game_dict = lebron_last_5_games.last5_player_dashboard.get_dict()
#lebron_5_game_dict_2 = lebron_last_5_games_2.last5_player_dashboard.get_dict()
print("Player:" + lebron_dict.get('data')[0][3] + ", Number: " + lebron_dict.get('data')[0][13] + "\n")
print(lebron_5_game_dict.get('data')[0][28])
print(players.find_players_by_full_name('LeBron James')[0].get('id'))
#print(lebron_5_game_dict_2.get('data')[0][28])
#print(lebron_5_game_dict_2)
Ejemplo n.º 5
0
from nba_api.stats.library.http import NBAStatsHTTP
from nba_api.stats.endpoints import playerdashboardbyteamperformance
from nba_api.stats.endpoints import teamdashboardbyteamperformance
from nba_api.stats.endpoints import playerdashboardbylastngames
from nba_api.stats.endpoints import teamplayerdashboard
from nba_api.stats.static import teams
from nba_api.stats.static import players
import pandas

#Player Input
player1_input = input('Enter player 1: ')
print(player1_input)

player1 = players.find_players_by_full_name(player1_input)[0]['id']

player_info = playerdashboardbylastngames.PlayerDashboardByLastNGames(
    player_id=player1)

#player_headers = player_info.overall_player_dashboard.get_dict().get('headers')
#player_data = player_info.overall_player_dashboard.get_dict().get('data')[0]

##last 20 games##
player_headers = player_info.last20_player_dashboard.get_dict().get('headers')
player_data = player_info.last20_player_dashboard.get_dict().get('data')[0]

print(player_headers[5], player_data[5], player_headers[2], player_data[2],
      player_headers[26], player_data[26], player_headers[27], player_data[27])

#Team Input

team1_input = input('Enter team 1: ')
print(team1_input)