Problem with pd.get_dummies() in streamlit cloud


I deployed a apps in a streamlit cloud, in my code used pd.get_dummies() and the app is was running ok, but now it doesn´t work beacuse afterthe command instead of obtain 1 and 0 in my table appear as selectbox in the variable such as:

I would llike to know how I can solve this issue.

Thanks for the help

pd.get_dummies returns booleans by default, but you can change that if you want. See the examples in the linked documentation.

1 Like

If you want to leave them as booleans, but display “True” or “False” instead, you can use st.column_config to show them as strings.

Thank you for you response, but now I have this Error:

ValueError: node array from the pickle has an incompatible dtype:
- expected: {'names': ['left_child', 'right_child', 'feature', 'threshold', 'impurity', 'n_node_samples', 'weighted_n_node_samples', 'missing_go_to_left'], 'formats': ['<i8', '<i8', '<i8', '<f8', '<f8', '<i8', '<f8', 'u1'], 'offsets': [0, 8, 16, 24, 32, 40, 48, 56], 'itemsize': 64}
- got     : [('left_child', '<i8'), ('right_child', '<i8'), ('feature', '<i8'), ('threshold', '<f8'), ('impurity', '<f8'), ('n_node_samples', '<i8'), ('weighted_n_node_samples', '<f8')]

What do you think?

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