Open
Description
Bug summary
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
import matplotlib.pyplot as plt
n = 1000000
vertical = [i for i in range(n)]
# Prepare the data
dates_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
%time plt.plot(dates_no_tz, vertical)
# Plot the time series with timezone
%time plt.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
Expected outcome
Expect a similar execution time
Additional information
No response
Operating system
No response
Matplotlib Version
3.8.0
Matplotlib Backend
module://matplotlib_inline.backend_inline
Python version
Python 3.9.18
Jupyter version
No response
Installation
pip