st.write(df) or st.dataframe(df) displays index as: 2020-01-01T00:15:00-05:00
I would like to display my table with this index format: 2020-01-01 00:15:00
Welcome @KevinAQM to streamlit community . First, the column you are setting to the index have this variable T as being shown in this picture you available to us? maybe the index are auto formatting T as time, because at the blue box you circled he didn’t show this parameter…
Hi, @feliperoque. My dataframe is correct, the index too.
When I print: df.index I get that, in the blue box: 2020-01-01 00:15:00. That is a proof my dataindex format is OK.
The problem occurs when I display the table with st.write(df) or st.dataframe(df), Streamlit creates the table with this format: 2020-01-01T00:15:00-05:00
I hope you can help me. I really like the style of that table, but I would like the dates to be readable and easy for the user to understand. (2020-01-01 00:15:00 )
@KevinAQM check this out, i think it’s not a problem but the way you used numpy. Here you can see the same format as you have in your index, with this T.
In this screeshot i took from you image, you can see the type of your index wich are datatime64[ns], which also return this T. I may think you gonna need to change the dtype from datetime64[ns] to another type.
This could also help:
OBS: Be aware, since this post is not a streamlit problem (is more python syntax), people here may not help you. Try to post this on stackoverflow, it’s more suitable.
Hi @KevinAQM, I know this thread is already 3 months old but I think I have found the solution after searching around for it. I’m not sure if it’s still something you’re looking for, but looking at your heroku app, you still haven’t really found the solution to it. I had the same predicament too and then realized that I need to look into the way PyArrow handles Pandas dataframe conversions.
Have you tried to convert your DateTime column in your Pandas df to strftime format prior to passing it into st.write() or st.dataframe() as such?