Editable data tables for float values

I’m currently reading the streamlit documentation trying to find a feature that allow me create editable data tables “a columns with editable cells like excel”

if anyone could give me some help, will be appreciated

Thanks in advance for your support :slight_smile:

1 Like

take a look here I think it can help you.

1 Like

This looks really awesome, but very complex…
By any chance is there another way to interact dynamically with dataframes ? Appending rows in existing dataframe or changing dataframes values on the fly ?

@blob123 I “think” (but @ash2shukla is the expert in this :slight_smile: so I’ll let him chime in…) you can use a combination of Bokeh datatable + streamlit-bokeh-events for editable tables, but that may be a bit more complex to use too…

Links:

I know the Streamlit team is thinking about it but there’s no immediate timeframe for its development so in the meantime if you need an editable datatable, your best bet is writing a component for it :thinking:

Have you looked at Streamlit’s add_rows functionality? You’ll see code examples for adding data to a dataframe and showing the result in a plot in real time.

For this one you may be better off overwriting the dataframe variable for now.

Best,
Fanilo

Many thanks Fanilo !

Hi @Romulo667, @blob123

A little too late but check this topic please,
Complete Bokeh DataTable Example using streamlit-bokeh-events :slight_smile:
Hope it helps!

@andfanilo, is it possible to get an example of a dataframe variable that could be overwritten ?

Many thanks @ash2shukla, but I’m having hard time running your last example (from state import provide_state => SyntaxError: invalid syntax)

You need to get the provide_state decorator from state module. you can find it here, https://gist.github.com/ash2shukla/ff180d7fbe8ec3a0240f19f4452acde7

Yes, that’s what I did, but do I just need to place the provide_state decorator in my folder ?

Yes just place it with your other modules…

Yes, I solved my issue: I used os.chdir(“C:\…”) in order to point on the directory where the decorator is present.

1 Like

This last example is really awesome.

But this is hard to implement in an user interactive app, because a bit far from a full editable dataframe in an “Excel” fashion, to record user’s inputs…

I try to create an app with an optimization function, variables and constraints: I don’t know how to input the various parameters of my bunch of constraints. That’s why I was also thinking of an editable table.

Maybe instead of this editable table, what could be the best way to populate e.g. a 4x4 table for the app user ?

1 Like