Dropdown: choose pandas df column and update plot with corresponding data

I have tried the following guides:

and

However, the former doesn’t include the obvious problem of choosing a different column and latter method does not work.

Is anyone able to provide a simple working example of this?

I have also searched a lot and found nothing but now this works for me.

df = pd.read_csv(input_file, decimal="," ,sep=";", error_bad_lines=False, parse_dates=True, nrows=args.num_rows)

  fig = px.scatter(df,  y="test1",
                   hover_data=[ 'test1',
                   'test2',]
  )

  buttonlist = []
  for col in df.columns:
      buttonlist.append(
        dict(
            args=['y',[df[str(col)]] ],
            label=str(col),
            method='restyle'
        )
      )

  fig.update_layout(
        title="Test data",
        yaxis_title="s",
        xaxis_title="activity",
        # Add dropdown
        updatemenus=[
            go.layout.Updatemenu(
                buttons=buttonlist,
                direction="down",
                pad={"r": 10, "t": 10},
                showactive=True,
                x=0.1,
                xanchor="left",
                y=1.1,
                yanchor="top"
            ),
        ],
        autosize=True
    )


  fig.show()