marimo icon indicating copy to clipboard operation
marimo copied to clipboard

[data editor] remove row limit on mo.ui.data_editor

Open akshayka opened this issue 7 months ago • 1 comments

Description

  • mo.ui.data_editor has a maximum of 1000 rows:
ValueError: Data editor supports a maximum of 1000 rows
  • most dataframes have far more rows than that

  • removing the max rows would make this element much more useful

(@delennc)

Suggested solution

No maximum on dataframe rows; table loaded via RPCs to backend, similar to ui.table?

Alternative

No response

Additional context

No response

akshayka avatar Apr 28 '25 16:04 akshayka

Further context from @delennc:

"I'd like to turn any of my dataframes editable to add annotation columns", with limits being fundamentally difficult to work with. Limits also make it unwieldy to write back to your original dataframe, since they require custom joining logic back to the main dataframe.

I am curious what Streamlit uses for their implementation of their data_editor . Here are some things I noticed:

  • No row limit, I tried a dataframe with 1 million rows, no problem.
  • Fast (infinite scroll)
  • Same renderer for data_editor and regular dataframes

Of course, while streamlit is just for apps, this could be useful when notebook-ing as well.

Streamlit code:

import streamlit as st
import pandas as pd


cmds = [
    {"command": "st.time_input", "rating": rating, "is_widget": True}
    for rating in range(1_000_000)
]
st.write("Data editor")
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},
        *cmds,
    ]
)
edited_df = st.data_editor(df)

st.write("Raw dataframe output, value of data editor")
st.write(edited_df)

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

Image

akshayka avatar Apr 28 '25 18:04 akshayka