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?
Thanks for stopping by! We use cookies to help us understand how you interact with our website.
By clicking “Accept all”, you consent to our use of cookies. For more information, please see our privacy policy.
Cookie settings
Strictly necessary cookies
These cookies are necessary for the website to function and cannot be switched off. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms.
Performance cookies
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us understand how visitors move around the site and which pages are most frequently visited.
Functional cookies
These cookies are used to record your choices and settings, maintain your preferences over time and recognize you when you return to our website. These cookies help us to personalize our content for you and remember your preferences.
Targeting cookies
These cookies may be deployed to our site by our advertising partners to build a profile of your interest and provide you with content that is relevant to you, including showing you relevant ads on other websites.