"Cannot accept list of column references or list of columns for both `x` and `y`." Error

@app.callback(

Output('indicator_graphic','figure'),

#Output('indicator_graphic2','figure'),

#Output('indicator_graphic3','figure'),

Input('wells_dropdown','value'),

Input('wells_properties_dropdown','value'))

def update_graph(wells_dropdown,wells_properties_dropdown):

well_data_filtered=well_data[well_data['wells']==wells_dropdown]

if wells_properties_dropdown=='Rates':
    
    fig_rates=px.line(x=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['date'],y=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['oil bopd','water bwpd','gas mmscfd'],color_discrete_map={'oil bopd':'green','water bwpd':'blue','gas mmscfd':'red'},height=900)
    
    return fig_rates

elif wells_properties_dropdown=='Pressures':
    
    fig_pressures=px.line(x=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['date'],y=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['fthp psi','bhp psi','p* psi'],color_discrete_map={'fthp psi':'green','bhp psi':'blue','p* psi':'red'},height=900)

    return fig_pressures

else:
    
    fig_bsw=px.line(x=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['date'],y=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['bs&w %'],color_discrete_map={'bs&w %':'blue'},height=900)
    
    return fig_bsw

app.run_server(mode=‘external’,port=8016)

Just try adding a couple more square brackets for y,

if wells_properties_dropdown=='Rates':
    
    fig_rates=px.line(x=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['date'],y=well_data_filtered[well_data_filtered['wells']==wells_dropdown][['oil bopd','water bwpd','gas mmscfd']],color_discrete_map={'oil bopd':'green','water bwpd':'blue','gas mmscfd':'red'},height=900)
    
    return fig_rates

elif wells_properties_dropdown=='Pressures':
    
    fig_pressures=px.line(x=well_data_filtered[well_data_filtered['wells']==wells_dropdown]['date'],y=well_data_filtered[well_data_filtered['wells']==wells_dropdown][['fthp psi','bhp psi','p* psi']],color_discrete_map={'fthp psi':'green','bhp psi':'blue','p* psi':'red'},height=900)

    return fig_pressures

Thank you so much for your help.

1 Like