-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Get roster of previous week? #35
Comments
Check out the league function load_roster_week(week=1). That should set the Teams roster to that week. I haven’t tried it for this season yet because week 1 just ended but I believe that is what you are looking for. |
Is there a way to tell which players were Bench vs. Rostered in this function? |
In the load_roster_week function, line 214 pulls the data. If you go to |
@joshbis at the moment no. Honestly I should probably put slot_position in the Player class. However, right now you can use box_scores(week=1) to get week 1 roster benched and rostered players for a team. |
Sorry, I'm dumb and maybe this isn't the place to ask, but is this an attribute of the player? I think I was hoping it would be pullable via the weekly box scores since that already has the points. i.e., league.teams[0].roster[0] gets me to the first player on the first team's roster. (beyond the scope of this is that the functions are great and I'd love more syntax examples for idiots) |
No worries. Yeah you can get this information from the box scores function. Here is a quick example below: >>> box_scores = league.box_scores(week=1)
>>> box_scores[0].home_team
Team(Team 1)
>>> box_scores[0].away_team
Team(Team Viking Queen)
>>> box_scores[0].home_score
69.24
>>> box_scores[0].away_score
87.62
>>> box_scores[0].home_lineup
[Player(Kareem Hunt, points:0, projected:0), Player(Travis Kelce, points:0, projected:0), Player(Zach Ertz, points:15, projected:9), Player(Josh Gordon, points:7, projected:8), Player(Kenyan Drake, points:21, projected:8), Player(Devin Funchess, points:0, projected:0), Player(Tarik Cohen, points:11, projected:8), Player(Wil Lutz, points:10, projected:7), Player(Dion Lewis, points:4, projected:9), Player(Matthew Stafford, points:5, projected:15), Player(Ezekiel Elliott, points:20, projected:17), Player(Brandin Cooks, points:0, projected:0), Player(Kerryon Johnson, points:0, projected:0), Player(Mitchell Trubisky, points:0, projected:0), Player(Bengals D/ST, points:6, projected:-3), Player(Courtland Sutton, points:7, projected:1)]
>>> box_scores[0].home_lineup[2].points
15.1
>>> box_scores[0].home_lineup[2].projected_points
9.97
>>> box_scores[0].home_lineup[2].slot_position
'TE'
>>> box_scores[0].home_lineup[2].position
'TE'
>>> box_scores[0].home_lineup[2].name
'Zach Ertz' I definitely need to update my documentation and add all of the fields and functions of the API to make it easier to use! Does this answer your question? |
Nice! That's super helpful. So that -- and other individual attributes -- is pulled player by player within the week's box score? I had started playing around with this to get the full week's lineup by iterating over the home and away teams:
With a little tinkering I could do the same with those slot positions. |
Exactly, so in each box_score object has each home and away team lineup which is a list of box_player objects that have that information. Does this help with your question on #38? For that question this would be the best option at the moment. |
yes -- I can delete #38 -- it helps to understand the tool as pulling information players within rosters within leagues and not the universe of all players at ESPN. I.e., you can find free agents but not their scores for a given week if they weren't on a roster? |
Correct right now you cannot. However, I am looking at the free agents endpoint and I believe I should be able to get projected and actual points of free agents. Would that be helpful field to have for free agents? |
I guess in the abstract I could imagine how it would be useful to someone using the API to analyze trades or scour the wires. In writing this out, though, it's beyond what I was doing -- pulling actual scores and graphing how they corresponded to auction values (I already have them, but it raises a question of whether these are stored anywhere). |
Yeah definitely and a lot of added features and data were ideas from other people that I didn't even think of. You can do a lot of cool stuff with the data! |
thanks -- here's my week one masterpiece. looking forward to playing around with it more over the course of the season. https://www.dropbox.com/s/u0zg32qze4zue1c/w1_payoffs.png?dl=0 |
A team's roster is listed under ['rosterForMatchupPeriod']['entries'] or ['rosterForCurrentScoringPeriod']['entries'], but after a week has concluded, neither ['rosterForMatchupPeriod'] or ['rosterForCurrentScoringPeriod'] exist anymore, only ['pointsByScoringPeriod']. Where can I find the roster for a previous week?
The text was updated successfully, but these errors were encountered: