Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this issue exists on the latest version of pandas.
-
I have confirmed this issue exists on the main branch of pandas.
Reproducible Example
import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
for freq in ['1ms', '10ms', '100ms', '1000ms', '1s', '10s', '1min', '100s', '10min', '1000s']:
for periods in [1e4, 1e5]:
dates = pd.date_range('2022-01-01 00:00:00', periods=periods, freq=freq)
values = np.random.rand(len(dates))
df = pd.DataFrame(data=values, index=dates)
start = datetime.now()
df.plot()
finish = datetime.now()
print(f'{periods:6.0f} at {freq:<6} took {finish - start}')
plt.close()
Installed Versions
INSTALLED VERSIONS
commit : 8dab54d
python : 3.11.1.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : AMD64 Family 23 Model 113 Stepping 0, AuthenticAMD
byteorder : little
LC_ALL : None
LANG : en_US.UTF-8
LOCALE : English_Australia.1252
pandas : 1.5.2
numpy : 1.23.4
pytz : 2022.6
dateutil : 2.8.2
setuptools : 65.5.0
pip : 22.3.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : None
pandas_datareader: None
bs4 : None
bottleneck : None
brotli : None
fastparquet : None
fsspec : None
gcsfs : None
matplotlib : 3.6.2
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.3
snappy : None
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : None
Prior Performance
I think this has been a long standing issue. Runnig the above code outputs the following:
10000 at 1ms took 0:00:00.185187
100000 at 1ms took 0:00:00.319529
10000 at 10ms took 0:00:00.165032
100000 at 10ms took 0:00:00.933138
10000 at 100ms took 0:00:00.793506
100000 at 100ms took 0:00:07.192190
10000 at 1000ms took 0:00:07.064933
100000 at 1000ms took 0:00:58.392849
10000 at 1s took 0:00:00.226735
100000 at 1s took 0:00:00.293485
10000 at 10s took 0:00:00.144515
100000 at 10s took 0:00:00.671181
10000 at 1min took 0:00:00.093631
100000 at 1min took 0:00:00.317967
10000 at 100s took 0:00:00.532972
100000 at 100s took 0:00:04.810899
10000 at 10min took 0:00:00.277081
100000 at 10min took 0:00:00.674374
10000 at 1000s took 0:00:04.690483
100000 at 1000s took 0:00:33.029342
There's no easily discernable reason why frequencies of '1000ms' has >100x plot render times than '1s'. The output plots look quite similar.