Use List of Dataframe Columns As Variables for a Google Collaboratory Form

Viewed 291

I'm trying to use a list of columns names found in a dataframe to be used as the drop down options in a Google Colab Form.

My code:

import ipywidgets as widgets

my_cols = ["col_option_1", "col_option_2", "option 3"]

#@title String fields
#dropdown = '1st option' #@param ["1st option", "2nd option", "3rd option"]

Essentially I want need something like this:

#@title String fields
#dropdown = '1st option' #@param **my_cols**

When I do that, there are no drop down options available.

Link to the Colab Sheet: https://colab.research.google.com/drive/1K4wMQIazJ6KyVJqBIxg23TLnjIXiIuYl#scrollTo=m8OcQd4dsZRs

I've read the documentation here: https://colab.research.google.com/notebooks/forms.ipynb#scrollTo=3jKM6GfzlgpS but can't make it work.

I've tried everything in this answer: How to use a variable as the input for a form field in Google Colaboratory? which describes my problem exactly, but can't make the solution work. (Perhaps deprecated)?

0 Answers
Related