Here is a simple example of the code I'm running, and I would like the results to fit in the pandas framework (if there is no better option):
for p in game.players.passing():
print p, p.team, p.passing_att, p.passer_rating()
R.Wilson SEA 29 55.7
J.Ryan SEA 1 158.3
A.Rodgers GB 34 55.8
Using this code:
d = []
for p in game.players.passing():
d = [{'Player': p, 'Team': p.team, 'Passer Rating':
p.passer_rating()}]
pd.DataFrame(d)
I can get:
Passer Rating Player Team
0 55.8 A.Rodgers GB
What frame size is 1x3, and I understand why this is only one row, but I cannot figure out how to make it multiline with the columns in the correct order. Ideally, the solution could deal with n number of rows (based on p), and it would be great (though not necessary) if the number of columns were given by the number of requested statistics. Any suggestions? Thanks in advance!
source
share