0

I cant get an updated value that will be used further from widget by using jupyter notebook, for example here the code run well for the first time and it gives dataframe table but when i change the dropdown no change for my table

vd = 'vd'
drop_down = widgets.Dropdown(options=['VD','TG','AI'],
                                description='Choose',
                                disabled=False)

def on_change_dropdown(change):
    global vd
    vd = change.new
drop_down.observe(on_change_dropdown, names='value')
display(drop_down)

#The code below works at first time when I run but after changing the drop down no change 
#create group based on this column
group = df.groupby(['thiscolumn'])
#cget group
g = group.get_group(drop_down.value)
g.head()
mne
  • 13
  • 6
  • You post isn't a minimal reproducible example. See about that under 'Help others reproduce the problem' at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask). Therefore it's hard to tell if your lack of things necessary for this to work are because you didn't post everything here or that you aren't following good current examples. That could be partly overcome by citing examples of what you are basing your code on. Without specific working code, it makes it hard to give you specifics back that will work, or be close to working with what you already have. Therefore, ... – Wayne Jul 19 '23 at 18:04
  • I can only give you general advice to check out related examples [here](https://stackoverflow.com/a/73144191/8508004) or [here](https://stackoverflow.com/a/75366661/8508004). Or if you wanted to work with Altair because it allows you to make nice interactive associated graphics, see [here](https://stackoverflow.com/q/75414637/8508004). – Wayne Jul 19 '23 at 18:10

0 Answers0