Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
This repository was archived by the owner on Sep 25, 2025. It is now read-only.

[FEATURE REQ] import_weekly_data() to pull weekly defensive performances #119

Description

@sedric11

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe.

Currently the offensive stats are pulled into the weekly data. However in daily fantasy sports, a DST position exists where each team's sacks, turnovers recovered, and return touchdowns are also calculated. It would be helpful if that position was returned in the weekly function.

# Function to get weekly data
def get_weekly_data(year):
    year_list = [int(year)]
    df = nfl.import_weekly_data(year_list)
    print(df['position'].value_counts())
    return df

position
WR 614
RB 385
TE 296
QB 195
FB 19
P 3
T 3
SS 1
CB 1

Describe the solution you'd like

Return an aggregate of the team's sacks, fumble recoveries, interceptions, blocked kicks, safeties, kick returns/interception/fumble recoveries when they result in a defensive touchdown, and points allowed to reflect the team's defensive performance for the given week.

Describe alternatives you've considered

No alternative exists in this program that I'm aware of

Additional context

Here is a list of all the relevant defensive stats that are used by draftkings and fanduel for daily fantasy scoring:

Defense -- Sack | +1 Pt Interception | +2 Pts Fumble Recovery | +2 Pts Punt/Kickoff/FG Return for TD | +6 Pts Interception Return TD | +6 Pts Fumble Recovery TD | +6 Pts Blocked Punt or FG Return TD | +6 Pts Safety | +2 Pts Blocked Kick | +2 Pts 2 Pt Conversion/Extra Point Return | +2 Pts 0 Points Allowed | +10 Pts 1 – 6 Points Allowed | +7 Pts 7 – 13 Points Allowed | +4 Pts 14 – 20 Points Allowed | +1 Pt 21 – 27 Points Allowed | +0 Pts 28 – 34 Points Allowed | -1 Pt 35+ Points Allowed | -4 Pts

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions