I have a dropdown menu that shows soms posssible 'cycles'. These are actually .csv files containing some data. Then I have another dropdown that should show all the variables in this .csv file. So this second dropdown should update according to the file selected in the first dropdown. I found a similar question and tried to implement this, but it did not work. The second dropdown remains empty. Note that I use pyspark to read the .csv files.
Cycles
is a tuple containing all the .csv files in my working directory.
scW1 = widgets.Dropdown(description = 'Select file',options = cycles)
scW2 = widgets.Dropdown(description = 'Select variable')
def plotvar(sender):
df=sc.textFile(str(scW1.value)).map(lambda x: x.split(','))
header = tuple(df.first())
print(header)
with scW2.hold_trait_notifications():
scW2.options = header
display(scW1)
display(scW2)
What goes wrong?