You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello. When plotting time series data using Matplotlib and Pandas, I have observed a significant difference in execution times between plots with and without timezones.
Code and Observation:
I have provided a code snippet below for reference:
Code for reproduction
importmatplotlib.pyplotaspltn=1000000vertical= [iforiinrange(n)]
# Prepare the datadates_no_tz=pd.date_range('2019-01-01', periods=n, freq='T')
dates_with_tz=pd.date_range('2019-01-01', periods=n, freq='T', tz='UTC')
# Plot the time series without timezone%timeplt.plot(dates_no_tz, vertical)
# Plot the time series with timezone%timeplt.plot(dates_with_tz, vertical)
Actual outcome
CPU times: user 50.6 ms, sys: 19.1 ms, total: 69.7 ms
Wall time: 71.2 ms
CPU times: user 3.44 s, sys: 192 ms, total: 3.63 s
Wall time: 3.69 s