Quantcast
Channel: 🎛️ Dash - Plotly Community Forum
Viewing all articles
Browse latest Browse all 6271

KeyError: 'outputs_list'

$
0
0

Hello,

Looking for some help here. I’m working on a dashboard of sports data.

There are 2 inputs: a dropdown for offense type, and a checklist for seasons to include. Depending on offense type, a different table will be returned.

I get no errors when running the script in my IDE; it generates a dashboard with the inputs that I have in the layout. However, the table itself is just blank cells. Please note: the table itself loads with the new column names, and the table headers change when I change the checklist selection. However, the cells themselves remain blank.

When I attempt to run update_table with some manual input, I get the following error message:

output_spec = kwargs.pop(“outputs_list”)**
KeyError: ‘outputs_list’**

Callback script is posted below. Thanks in advance for any help.

@app.callback(
[Output(‘datatable’, ‘data’),
Output(‘datatable’,‘columns’)],
[Input(‘season_select’,‘value’),
Input(‘offense_type’, ‘value’)])

def update_table(season, offense_type):

dff = df[df.year.isin(season)]

passing_cols = ['Player','Team','Conference','Opponent','Week','Year','Pass Att','Comp','Pass Yds','Pass TD','INT','Sack','Fumble','EPA']
rushing_cols = ['Player','Team','Conference','Opponent','Week','Year','Rush Att','Rush Yds','Rush TD','Fumble','EPA']
receiving_cols = ['Player','Team','Conference','Opponent','Week','Year','Targets','Receptions','Receiving Yards','Receiving TDs','Fumble','EPA']

if offense_type == 'Passing':
    data = dff[dff.pass_attempt == 1].groupby(['passer'
            ,'offense'
            ,'offense_conference'
            ,'defense'
            ,'week'
            ,'year'])[['pass_attempt'
                ,'complete_pass'
                ,'yards_gained'
                ,'touchdown_pass'
                ,'interception'
                ,'sack'
                ,'fumble'
                ,'ppa']].sum().reset_index(drop=False).to_dict('records')
    columns=[{'name':i,'id':i} for i in passing_cols]

elif offense_type == 'Rushing':
    data = dff[dff.rush_attempt == 1].groupby(['rusher'
            ,'offense'
            ,'offense_conference'
            ,'defense'
            ,'week'
            ,'year'])[['rush_attempt'
                ,'yards_gained'
                ,'touchdown_rush'
                ,'fumble'
                ,'ppa']].sum().reset_index(drop=False).to_dict('records')
    columns=[{'name':i,'id':i} for i in rushing_cols]

else:
    data = dff[dff.pass_attempt == 1].groupby(['receiver'
            ,'offense'
            ,'offense_conference'
            ,'defense'
            ,'week'
            ,'year'])[['pass_attempt'
                ,'complete_pass'
                ,'yards_gained'
                ,'touchdown_pass'
                ,'fumble'
                ,'ppa']].sum().reset_index(drop=False).to_dict('records')
    columns=[{'name':i,'id':i} for i in receiving_cols]

return data, columns

if name == ‘main’:
app.run_server(debug=True)

6 posts - 2 participants

Read full topic


Viewing all articles
Browse latest Browse all 6271

Trending Articles