Datetimeindex format

Hello there, community:

I’m using Streamlit for my Python Data Science Web Projects. So far, so good.

But, why I get this format on my DateTime index?

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

Thanks in advance for your support.

If you want you can see my web project on:

Welcome @KevinAQM to streamlit community :eyes:. 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 :white_check_mark:)

Have a nice day!

@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.