streamlit: Allow configuration of missing value placeholder in `st.dataframe`

Checklist

  • I have searched the existing issues for similar feature requests.
  • I added a descriptive title and summary to this issue.

Summary

In st.data_editor, when you dont have a value for a determined cell, it will be showed as None: image

Why?

Since it is very user-unfriendly (a non-tech person may not understand what means None), it will be interesting have a parameter in st.data_editor that allows to replace these None by, for example, empty string (“”), that will looks like this, but only for view purposes, without messing up the output. image

How?

a parameter like: none_alias="" that allows me to change the None showing in the table.

Additional Context

No response

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 29
  • Comments: 18 (1 by maintainers)

Most upvoted comments

To help Streamlit prioritize this feature, react with a 👍 (thumbs up emoji) to the initial post.

Your vote helps us identify which enhancements matter most to our users.

Views

Some update on this @LukasMasuch ?

hmm, looking at pandas .format - there’s an na_rep property, which could be used exactly for this, if supported on Streamlit side (currently I saw no difference in my tests).

Example from docs:

df = pd.DataFrame([[np.nan, 1.0, 'A'], [2.0, np.nan, 3.0]])
df.style.format(na_rep='MISS', precision=3)

We decided against using an empty string as the default placeholder since it wouldn’t be completely accurate. For example, there is a semantic difference between an empty string value and a None value in a text column, which couldn’t be reflected with an empty string placeholder. However, for many use cases, this might not really matter. And making this configurable seems to be a pretty good solution for this 👍 Maybe calling it just placeholder could also be a good choice since it’s a bit comparable to the empty state placeholders we recently added to some of our widgets.

I’m onboard with the change. To add new features we try to get some internal consensus and there are a lot of similar features also waiting for decisions and priority. I can bring it up again with the team.