Package nflgame :: Module player :: Class PlayerStats
[frames] | no frames]

Class PlayerStats

source code

object --+
         |
        PlayerStats
Known Subclasses:

Player represents a single player and all of his statistical categories. Every player has 'playerid', 'name' and 'home' fields. Additionally, depending upon which statistical categories that player was involved in for the game, he'll have properties such as 'passing_tds', 'rushing_yds', 'defense_int' and 'kicking_fgm'.

In order to know whether a paricular player belongs to a statical category, you may use the filtering methods of a player sequence or alternatively, use the has_cat method with arguments like 'passing', 'rushing', 'kicking', etc. (A player sequence in this case would be an instance of GenPlayerStats.)

You may also inspect whether a player has a certain property by using the special __dict__ attribute. For example:

   if 'passing_yds' in player.__dict__:
       # Do something with player.passing_yds
Instance Methods
 
__init__(self, playerid, name, home)
Create a new Player instance with the player id (from NFL.com's GameCenter), the player's name (e.g., "T.Brady") and whether the player is playing in a home game or not.
source code
 
has_cat(self, cat) source code
 
formatted_stats(self)
Returns a roughly-formatted string of all statistics for this player.
source code
 
__str__(self)
Simply returns the player's name, e.g., "T.Brady".
source code
 
__add__(self, other)
Adds two players together.
source code
 
__sub__(self, other) source code
 
__getattr__(self, name) source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __subclasshook__

Properties
  tds
Returns the total number of touchdowns credited to this player across all statistical categories.
  twopta
Returns the total number of two point conversion attempts for the passing, rushing and receiving categories.
  twoptm
Returns the total number of two point conversions for the passing, rushing and receiving categories.
  twoptmissed
Returns the total number of two point conversion failures for the passing, rushing and receiving categories.
  stats
Returns a dict of all stats for the player.

Inherited from object: __class__

Method Details

__init__(self, playerid, name, home)
(Constructor)

source code 

Create a new Player instance with the player id (from NFL.com's GameCenter), the player's name (e.g., "T.Brady") and whether the player is playing in a home game or not.

Overrides: object.__init__

__str__(self)
(Informal representation operator)

source code 

Simply returns the player's name, e.g., "T.Brady".

Overrides: object.__str__

__add__(self, other)
(Addition operator)

source code 

Adds two players together. Only two player objects that correspond to the same human (i.e., GameCenter identifier) can be added together.

If two different players are added together, an assertion will be raised.

The effect of adding two player objects simply corresponds to the sums of all statistical values.

Note that as soon as two players have been added, the 'home' property becomes undefined.


Property Details

tds

Returns the total number of touchdowns credited to this player across all statistical categories.

Get Method:
unreachable.tds(self) - Returns the total number of touchdowns credited to this player across all statistical categories.

twopta

Returns the total number of two point conversion attempts for the passing, rushing and receiving categories.

Get Method:
unreachable.twopta(self) - Returns the total number of two point conversion attempts for the passing, rushing and receiving categories.

twoptm

Returns the total number of two point conversions for the passing, rushing and receiving categories.

Get Method:
unreachable.twoptm(self) - Returns the total number of two point conversions for the passing, rushing and receiving categories.

twoptmissed

Returns the total number of two point conversion failures for the passing, rushing and receiving categories.

Get Method:
unreachable.twoptmissed(self) - Returns the total number of two point conversion failures for the passing, rushing and receiving categories.

stats

Returns a dict of all stats for the player.

Get Method:
unreachable.stats(self) - Returns a dict of all stats for the player.