Is there a way to display autocomplete in the text box with @ or any identifier with the list of columns in the dataframe?

We have a use case to calculate and add columns from a existing columns in the data frame. Is there a way we can display the list of column names in the text box where user can perform operations with the autocomplete feature of column names and write expressions like (column1 = column2 + Column3)

Hey @jenil, welcome!

If I’m understanding the need correctly I think using streamlit multiselect or streamlit-tags component will give your users the ability to pick “column2” and “column3” for example.

I’d recommend passing your df.columns or list(df.columns) into the options parameter for st.multiselect('choose columns', df.columns) (This will be slightly different with streamlit-tags)

The expressions part will be dependent on your usecases. Maybe provide another drop down and link those options to python operator function calls?

If you’re allowed to share a code snippet of what you’ve tried so far others might be able to chime in more!

Thanks for the suggestion…I will try with multiselect and operations…

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.