Replies: 1 comment
-
HI @bdf0506 I implement this in my repo like this. def get_total_tds(league: League, lineup: List[Player]) -> float:
"""
Returns the total number of TDs scored by the starting roster.
"""
total_tds = 0
for player in lineup:
# Skip non-starting players
if player.slot_position in ("BE", "IR"):
continue
# Skip players with no stats (players on Bye)
if not list(player.stats.keys()):
continue
player_tds = 0
for statId in [
"passingTouchdowns",
"rushingTouchdowns",
"receivingTouchdowns",
"defensiveBlockedKickForTouchdowns",
"defensiveTouchdowns",
"kickoffReturnTouchdowns",
"puntReturnTouchdowns",
"interceptionReturnTouchdowns",
"fumbleReturnTouchdowns",
"defensivePlusSpecialTeamsTouchdowns",
]:
week = list(player.stats.keys())[0]
if "breakdown" in player.stats[week].keys():
if statId in player.stats[week]["breakdown"].keys():
player_tds += player.stats[week]["breakdown"][statId]
total_tds += player_tds
return total_tds You can pass in |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm looking for a way to pull the total number of TDs that each team in the ESPN fantasy football league has scored. Is this data exposed via this package? I don't believe it is, but I might be looking in the wrong spot. Any ideas?
Beta Was this translation helpful? Give feedback.
All reactions