My dataframe is in local timezone but when I plot the data using st.linechart(). Data is plotted automatically in the UTC timezone even though I have converted the data to local time zone.
Is the problem in my code or streamlit only plots using the UTC timezone automatically irrespective of the timezone info in dataframe.
Streamlit, by default, uses Vega Lite for plotting which displays time data in UTC regardless if timezone info in dataframe.
In your case, since you are using st.line_chart, Streamlit’s default behavior is to plot the data in UTC if it detects date values. You have a couple of options to resolve this. One is by manually adjusting the timezone within your data so that Vega Lite won’t interpret it as a date value and convert it to UTC.
Please share your code if this does not help resolve the issue.
I am getting the data in UTC format from data source, But I want to plot it in UTC-4 time zone
I have manually changed the data frame to UTC-4 time zone. But when I am plotting the same converted data frame, it is getting plotted in UTC time zone.
So basically I am fetching data from an API, and I am getting the data in UTC format from API.
So this is the function to fetch the data.
I want to give the start and end date in the function. Below is the code for date selection.
Here I want to select the date such that start date is automatically in UTC-4 format. For example if I want data from midnight i should be able to select the date such that it gives me the data on the basis of local time zone but not UTC.
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.