Find the index of career stats.

        When the Player class is instantiated, the default stats to pull are
        the player's career stats. Upon being called, the index of the 'Career'
        element should be the index value.
439702
def _find_initial_index(self):
        
        index = 0
        for season in self._season:
            if season == 'Career':
                self._index = index
                break
            index += 1
228286
def get_projected_player_game_stats_by_player(self, season, week, player_id):
        
        result = self._method_call("PlayerGameProjectionStatsByPlayerID/{season}/{week}/{player_id}", "projections", season=season, week=week, player_id=player_id)
        return result
342914
def stats(self):
        
        if not self.is_authenticated_athlete():
            raise exc.NotAuthenticatedAthlete("Statistics are only available for the authenticated athlete")
        if self._stats is None:
            self.assert_bind_client()
            self._stats = self.bind_client.get_athlete_stats(self.id)
        return self._stats
670369
public function majRankPointChart()
    {
        $teams = $this->findBy(array(), array('pointChart' => 'DESC'));

        $list = array();
        foreach ($teams as $team) {
            $list[] = $team;
        }

        Ranking::addObjectRank($list, 'rankPointChart', array('pointChart'));
        $this->getEntityManager()->flush();
    }
222957
def dataframe(self):
        
        if self._points_allowed is None and self._points_scored is None:
            return None
        fields_to_include = {
            'boxscore_index': self.boxscore_index,
            'date': self.date,
            'datetime': self.datetime,
            'game': self.game,
            'location': self.location,
            'losses': self.losses,
            'opponent_abbr': self.opponent_abbr,
            'opponent_name': self.opponent_name,
            'points_allowed': self.points_allowed,
            'points_scored': self.points_scored,
            'result': self.result,
            'streak': self.streak,
            'time': self.time,
            'wins': self.wins
        }
        return pd.DataFrame([fields_to_include], index=[self._boxscore])
588639
def two_pointers(self):
        
        if self.field_goals and self.three_pointers:
            return int(self.field_goals - self.three_pointers)
        # Occurs when the player didn't make any three pointers, so the number
        # of two pointers the player made is equal to the total number of field
        # goals the player made.
        if self.field_goals:
            return int(self.field_goals)
        # If the player didn't make any shots, they didn't make any two point
        # field goals.
        return None
1251152
def team_players(self, team):
        """"""
        keys = 'shirtNumber name position nationality dateOfBirth'.split()
        data = [{key: player[key] for key in keys} for player in team]
        self.generate_output({'players': data})
508754
def dataframe(self):
        
        fields_to_include = {
            'abbreviation': self.abbreviation,
            'average_age': self.average_age,
            'games_played': self.games_played,
            'goals_against': self.goals_against,
            'goals_for': self.goals_for,
            'losses': self.losses,
            'name': self.name,
            'overtime_losses': self.overtime_losses,
            'pdo_at_even_strength': self.pdo_at_even_strength,
            'penalty_killing_percentage': self.penalty_killing_percentage,
            'points': self.points,
            'points_percentage': self.points_percentage,
            'power_play_goals': self.power_play_goals,
            'power_play_goals_against': self.power_play_goals_against,
            'power_play_opportunities': self.power_play_opportunities,
            'power_play_opportunities_against':
            self.power_play_opportunities_against,
            'power_play_percentage': self.power_play_percentage,
            'rank': self.rank,
            'save_percentage': self.save_percentage,
            'shooting_percentage': self.shooting_percentage,
            'short_handed_goals': self.short_handed_goals,
            'short_handed_goals_against': self.short_handed_goals_against,
            'shots_against': self.shots_against,
            'shots_on_goal': self.shots_on_goal,
            'simple_rating_system': self.simple_rating_system,
            'strength_of_schedule': self.strength_of_schedule,
            'total_goals_per_game': self.total_goals_per_game,
            'wins': self.wins
        }
        return pd.DataFrame([fields_to_include], index=[self._abbreviation])
583539
public function majRankCup()
    {
        $this->majGameRank();
        $players = $this->findBy(array(), array('gameRank0' => 'DESC', 'gameRank1' => 'DESC', 'gameRank2' => 'DESC', 'gameRank3' => 'DESC'));

        Ranking::addObjectRank($players, 'rankCup', array('gameRank0', 'gameRank1', 'gameRank2', 'gameRank3'));

        $this->getEntityManager()->flush();
    }
783570
def __get_league_object():
    """"""
    # get data
    data = mlbgame.data.get_properties()
    # return league object
    return etree.parse(data).getroot().find('leagues').find('league')
182225
def leagues_by_summoner_ids(summoner_ids, queue=Queue.RANKED_SOLO_5x5):
    
    summoners_league = defaultdict(set)
    for start, end in _slice(0, len(summoner_ids), 10):
        for id, leagues in get_league_entries_by_summoner(summoner_ids[start:end]).items():
            for league in leagues:
                if Queue[league.queue]==queue:
                    summoners_league[Tier.parse(league.tier)].add(int(id))
    return summoners_league
104017
public Object getData() 
    {
        try {
            Object objValue = super.getData();    // Get the actual key data.
            if (objValue == null)
                objValue = m_strNullValue;
            if (objValue == null)
                return null;
            if (objValue.getClass() == m_fieldKey.getDataClass())
                m_fieldKey.setData(objValue);
            else
                m_fieldKey.setString(objValue.toString());
            if (m_record.getTable().seek(null) == true)  // I use get, so the index matches the index of JComboBox
                return m_fieldData.getData();
        } catch (Exception ex)  {
            ex.printStackTrace();
        }
        return null;
    }
1232313
def team_players(self, team):
        """"""
        headers = ['Jersey Number', 'Name', 'Position', 'Nationality',
                   'Date of Birth']
        result = [headers]

        result.extend([player['shirtNumber'],
                       player['name'],
                       player['position'],
                       player['nationality'],
                       player['dateOfBirth']]
                      for player in team)
        self.generate_output(result)
116929
def get_season_player_stats(self, season_key, player_key):
        

        season_player_stats_url = self.api_path + "season/" + season_key + "/player/" + player_key + "/stats/"
        response = self.get_response(season_player_stats_url)
        return response
1027405
def players(game_id):
    """"""
    # get data
    data = mlbgame.data.get_players(game_id)
    # parse data
    parsed = etree.parse(data)
    root = parsed.getroot()

    output = {}
    output['game_id'] = game_id

    # get player/coach data
    for team in root.findall('team'):
        type = team.attrib['type'] + "_team"
        # the type is either home_team or away_team
        output[type] = {}
        output[type]['players'] = []
        output[type]['coaches'] = []

        for p in team.findall('player'):
            player = {}
            for key in p.keys():
                player[key] = p.get(key)
            output[type]['players'].append(player)

        for c in team.findall('coach'):
            coach = {}
            for key in c.keys():
                coach[key] = c.get(key)
            output[type]['coaches'].append(coach)

    # get umpire data
    output['umpires'] = []
    for u in root.find('umpires').findall('umpire'):
        umpire = {}
        for key in u.keys():
            umpire[key] = u.get(key)
        output['umpires'].append(umpire)

    return output
675007
def get_model_index(cls, model, default=True):
        '''
        
        '''
        try:
            if default:
                return cls._model_name_to_default_index[model]
            return cls._model_name_to_model_idx[model]
        except KeyError:
            raise KeyError('Could not find any model index defined for model {}.'.format(model))
422638
function getPlayerCounters(player, attacker, game) {
  return player.hand
    .map((card) => {
      return card.validCounters ? card.validCounters(player, attacker, game) : []
    })
    .reduce((acc, array) => {
      return acc.concat(array)
    }, [])
    .sort((counterA, counterB) => counterB.weight - counterA.weight)
}