-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Timezones for PeriodIndex #2106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
xref: #2232 |
I am having the same problem here with the latest stable version of Pandas. |
these r not supported |
same issue, what's not supported? |
|
As a workaround, you can remove the timezone info from the DateTimeIndex of the data which you're wishing to plot using |
going to close this issue. This add needless complication because Periods can actually fall in more than 1 tz (e.g. on a DST change), when tz's are quite well supported on DTIs / Timestamps and the conversions are pretty straightforward. |
This StackExchange response leads to this issue. |
@stroobandt this is the solution I ended up using, I chose a timezone for the plot, and go with this: import matplotlib.pytplot as plt, pandas as pd
df = pd.Dataframe(...)
fig, ax = plt.subplots()
df.plot(ax=ax)
import matplotlib.dates as mdates
from pytz import timezone
ax.xaxis.set_major_formatter(mdates.DateFormatter('%d/%m %H:%M', timezone('Europe/Amsterdam')))
fig.show() |
I just tried to reproduce the issue described on StackOverflow and couldn't. Pandas plots the graph in whatever timezone the data is passed. That's exactly what a typical user would expect. The timezone is not mentioned anywhere on the plot. Code from StackOverflow:
UTC figure: CET figure: This is on Pandas 1.2.4. |
from SO: http://stackoverflow.com/questions/13030402/pandas-plot-function-ignores-timezone-of-timeseries
The text was updated successfully, but these errors were encountered: