'Plotly type error multiple values for arguement

I need help with the following code. I'm playing around with Plotly and i'm trying to create a line graph for the sales vs the year. Below is the code:

# set up environment
from dash import Dash, dcc, html, Output, Input
import plotly.graph_objs as go
import pandas as pd
import numpy as np
import plotly.express as px

# app set up
app = Dash(__name__)

# load and clean dataset
df = pd.read_csv('sales_data_sample.csv', encoding = 'Latin-1')
df = df.drop(['ADDRESSLINE2', 'STATE', 'POSTALCODE', 'TERRITORY'], axis = 1) # remove nulls
df.columns = df.columns.str.lower() # lower the column names to make it easier to type

# draw line graph
fig = go.Figure(data=[go.Scatter(x = df['year_id'], y = df['sales'])])

# layout
app.layout = html.Div([
    html.Div([
        
        html.Div(children = [
            html.H1('Sales Snapshot'),

            html.Div(children = '''
            Summary information from sample Dataset
            ''')
            ], style = {'textAlign': 'center', 'marginTop': 40, 'marginBottom': 40}),

            html.Div([
                dcc.Dropdown(
                    [df['productline'].unique()],  id = 'product-dropdown-1'),
                    html.Div(id = 'dd-output-container')
            ]),
            
            html.Div([
                dcc.Graph(
                    figure = fig,
                    id = 'line-container'
            )
        ])            
    ])
])

@app.callback(
    Output('dd-output-container', 'children'),
    Input('product-dropdown-1', 'value')
)
def update_output(value):
    return f'You have selected {value}'


# app run
if __name__ == '__main__':
    app.run_server(debug = True)

I keep getting this error:

TypeError: init() got multiple values for argument 'id'

I can't figure out where the problem is. I don't know why its getting multiple values for id, i'm assigning the argument that plotly is asking for.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source