Description
Pandas version checks
-
I have checked that this issue has not already been reported.
-
I have confirmed this bug exists on the latest version of pandas.
-
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
from pandas.tseries.offsets import CustomBusinessDay
import pandas_market_calendars as mcal
nyse = mcal.get_calendar('NYSE')
us_bd = CustomBusinessDay(calendar=nyse)
date_range = pd.date_range('2024-12-20', periods=10, freq=us_bd)
correct_schedule = nyse.schedule(start_date='2024-12-23', end_date='2025-01-10')
Issue Description
CustomBusinessDay is not properly showing the correct calendar holiday dates. When displaying date_range in the code above you'll see that 2024-12-25 is being included which was a market holiday and is not shown in correct_schedule in the code above.
Expected Behavior
I would expect for us_bd to respect the dates in 'correct_schedule' and not include market holidays as it has in the past. When running todays date minus 1 us_bd it is showing new years day which also should be excluded and the correct result should yield '2024-12-31'
Installed Versions
INSTALLED VERSIONS
commit : f538741
python : 3.10.13.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19045
machine : AMD64
processor : Intel64 Family 6 Model 207 Stepping 2, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 2.2.0
numpy : 1.26.4
pytz : 2023.3
dateutil : 2.8.2
setuptools : 68.2.2
pip : 23.3.1
Cython : 3.0.8
pytest : 8.3.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : None
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.3
IPython : 8.21.0
pandas_datareader : None
adbc-driver-postgresql: None
adbc-driver-sqlite : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat : None
fastparquet : None
fsspec : 2023.6.0
gcsfs : None
matplotlib : 3.8.2
numba : None
numexpr : 2.10.1
odfpy : None
openpyxl : 3.1.2
pandas_gbq : None
pyarrow : 15.0.0
pyreadstat : None
python-calamine : None
pyxlsb : None
s3fs : None
scipy : 1.12.0
sqlalchemy : None
tables : None
tabulate : None
xarray : None
xlrd : 2.0.1
zstandard : None
tzdata : 2024.1
qtpy : None
pyqt5 : None