# Source: https://docs.streamlit.io/develop/api-reference/data/st.data_editor

# st.data_editor

Display a data editor widget.

The data editor widget allows you to edit dataframes and many other data structures in a table-like UI.

## Example 1: Basic usage

```python
import pandas as pd
import streamlit as st

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}** 🎈")
```

## Example 2: Allowing users to add and delete rows

You can allow your users to add and delete rows by setting `num_rows` to "dynamic":

```python
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, num_rows="dynamic")

favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** 🎈")
```

## Example 3: Data editor configuration

You can customize the data editor via `column_config`, `hide_index`, `column_order`, or `disabled`:

```python
import pandas as pd
import streamlit as st

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,
    column_config={
        "command": "Streamlit Command",
        "rating": st.column_config.NumberColumn(
            "Your rating",
            help="How much do you like this command (1-5)?",
            min_value=1,
            max_value=5,
            step=1,
            format="%d ⭐",
        ),
        "is_widget": "Widget ?",
    },
    disabled=["command", "is_widget"],
    hide_index=True,
)

favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]
st.markdown(f"Your favorite command is **{favorite_command}** 🎈")
```

## Configuring columns

You can configure the display and editing behavior of columns in `st.dataframe` and `st.data_editor` via the `Column configuration API`. We have developed the API to let you add images, charts, and clickable URLs in dataframe and data editor columns. Additionally, you can make individual columns editable, set columns as categorical and specify which options they can take, hide the index of the dataframe, and much more.

## Additional Resources

- [Cheat sheet](/develop/quick-reference/cheat-sheet)
- [Documentation](https://docs.streamlit.io/develop/api-reference/data/st.data_editor)
- [API reference](/develop/api-reference/data/st.data_editor)
- [Tutorials](/develop/tutorials)
- [Quick reference](/develop/quick-reference)
- [Deploy](/deploy)
- [Knowledge base](/knowledge-base)