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
import pandas as pd
pd.date_range('2000-01-03 00:00:00', freq=pd.offsets.BusinessHour(start='00:00', end='23:59'), periods=25)
DatetimeIndex(['2000-01-03 00:00:00', '2000-01-03 01:00:00',
'2000-01-03 02:00:00', '2000-01-03 03:00:00',
'2000-01-03 04:00:00', '2000-01-03 05:00:00',
'2000-01-03 06:00:00', '2000-01-03 07:00:00',
'2000-01-03 08:00:00', '2000-01-03 09:00:00',
'2000-01-03 10:00:00', '2000-01-03 11:00:00',
'2000-01-03 12:00:00', '2000-01-03 13:00:00',
'2000-01-03 14:00:00', '2000-01-03 15:00:00',
'2000-01-03 16:00:00', '2000-01-03 17:00:00',
'2000-01-03 18:00:00', '2000-01-03 19:00:00',
'2000-01-03 20:00:00', '2000-01-03 21:00:00',
'2000-01-03 22:00:00', '2000-01-03 23:00:00',
'2000-01-04 00:01:00'],
dtype='datetime64[ns]', freq='BH')
Issue Description
I have a time series dataset that produces data every hour from Monday to Friday and no data on Saturday and Sunday. I am unable to create these time stamps using pd.offsets.BusinessHour
. There is an issue with the crossover between days. As you can see above, the timestamp 2000-01-04 00:00:00 is completely missing.
If this is not a bug, could anyone please let me know how to produce these time indices.
Expected Behavior
DatetimeIndex(['2000-01-03 00:00:00', '2000-01-03 01:00:00',
'2000-01-03 02:00:00', '2000-01-03 03:00:00',
'2000-01-03 04:00:00', '2000-01-03 05:00:00',
'2000-01-03 06:00:00', '2000-01-03 07:00:00',
'2000-01-03 08:00:00', '2000-01-03 09:00:00',
'2000-01-03 10:00:00', '2000-01-03 11:00:00',
'2000-01-03 12:00:00', '2000-01-03 13:00:00',
'2000-01-03 14:00:00', '2000-01-03 15:00:00',
'2000-01-03 16:00:00', '2000-01-03 17:00:00',
'2000-01-03 18:00:00', '2000-01-03 19:00:00',
'2000-01-03 20:00:00', '2000-01-03 21:00:00',
'2000-01-03 22:00:00', '2000-01-03 23:00:00',
'2000-01-04 00:00:00'],
dtype='datetime64[ns]', freq='BH')
Timestamp '2000-01-04 00:00:00' should be present.
Installed Versions
INSTALLED VERSIONS
commit : a671b5a
python : 3.10.12.final.0
python-bits : 64
OS : Linux
OS-release : 5.15.146.1-microsoft-standard-WSL2
Version : #1 SMP Thu Jan 11 04:09:03 UTC 2024
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : C.UTF-8
LOCALE : en_US.UTF-8
pandas : 2.1.4
numpy : 1.26.4
pytz : 2024.2
dateutil : 2.9.0.post0
setuptools : 69.5.1
pip : None
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.4
IPython : 8.30.0
pandas_datareader : None
bs4 : 4.12.3
bottleneck : None
dataframe-api-compat: None
fastparquet : None
fsspec : 2024.12.0
gcsfs : None
matplotlib : 3.10.0
numba : 0.60.0
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : 18.1.0
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.14.1
sqlalchemy : 2.0.36
tables : None
tabulate : 0.9.0
xarray : None
xlrd : 2.0.1
zstandard : 0.23.0
tzdata : 2024.2
qtpy : None
pyqt5 : None