AttributeError: module 'streamlit' has no attribute 'data_editor'

Iā€™m running streamlit 1.24.1 but when using st.data_editor(df) to create editable data frames Iā€™m receiving this error :

AttributeError: module ā€˜streamlitā€™ has no attribute ā€˜data_editorā€™

any clues on how to resolve this ?

Hi @Salem_M_Adouni,

Thanks for posting!

Try upgrading Streamlit and trying again:

pip install streamlit --upgrade

Let me know if this resolves the issue.

Hi @Salem_M_Adouni and welcome to our forum! :wave:

Trying to reinstall Streamlit as @tonykip is suggesting is a good thing to try.

In case that doesnā€™t work, I havenā€™t seen your code, but this is how data_editor should be called:

import streamlit as st
import pandas as pd

df = pd.DataFrame(
    [
       {"command": "st.selectbox", "rating": 4, "is_widget": True},
       {"command": "st.balloons", "rating": 5, "is_widget": False},
       {"command": "st.time_input", "rating": 3, "is_widget": True},
   ]
)
edited_df = st.data_editor(df)

favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** šŸŽˆ")

Happy Streamliting! :balloon:

Charly

1 Like

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