Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow SelectBoxes, Radio Buttons, and MultiSelect to use DataFrames #1785

Merged
merged 3 commits into from Jul 30, 2020

Conversation

kmcgrady
Copy link
Collaborator

Issue: #78

Description:
When a DataFrame is sent as an argument, the component will select options from the first column.


Contribution License Agreement

By submitting this pull request you agree that all contributions to this project are made under the Apache 2.0 license.

When a DataFrame is sent as an argument, the component will select
options from the first column.
@kmcgrady kmcgrady requested a review from a team as a code owner July 29, 2020 18:16
Copy link
Contributor

@tconkling tconkling left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

Nit: ensure_iterable feels like the wrong name for this new function, since it doesn't actually ensure that its input is iterable unless that input is a dataframe.

(If I passed some random non-iterable object to ensure_iterable, I'd assume that it'd either return a new object that was somehow iterable, or throw an exception.)

Something like make_iterable_if_dataframe would be clearer (if verbose and clunky sounding)

@kmcgrady
Copy link
Collaborator Author

Thanks @tconkling ! My only thought was if we decide to support more list-like types, we would just add to the ensure_iterable function. I could just throw an exception if iter(obj) throws an exception. It should then work in all the other cases. Thoughts?

@tconkling
Copy link
Contributor

Throwing an exception seems reasonable to me!

@kmcgrady kmcgrady merged commit 3f37218 into streamlit:develop Jul 30, 2020
@kmcgrady kmcgrady deleted the dataframe-list-78 branch July 30, 2020 02:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants