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
import datetime as dt
freq = pd.offsets.CustomBusinessHour(weekmask="Sat Sun", start="00:00", end="16:00")
pd.date_range(dt.datetime(2020,1,1), dt.datetime(2020,1,15), freq=freq)
Issue Description
Expected to return every hour of a day from midnight to 16:00, but when including end='16:00' that last hour isn't captured. Per the doc it states that end defaults to '16:00'. You can put any hour for end and it doesn't capture that final hour.
DatetimeIndex(['2020-01-04 00:00:00', '2020-01-04 01:00:00',
'2020-01-04 02:00:00', '2020-01-04 03:00:00',
'2020-01-04 04:00:00', '2020-01-04 05:00:00',
'2020-01-04 06:00:00', '2020-01-04 07:00:00',
'2020-01-04 08:00:00', '2020-01-04 09:00:00',
'2020-01-04 10:00:00', '2020-01-04 11:00:00',
'2020-01-04 12:00:00', '2020-01-04 13:00:00',
'2020-01-04 14:00:00', '2020-01-04 15:00:00',
'2020-01-05 00:00:00', '2020-01-05 01:00:00',
'2020-01-05 02:00:00', '2020-01-05 03:00:00',
'2020-01-05 04:00:00', '2020-01-05 05:00:00',
'2020-01-05 06:00:00', '2020-01-05 07:00:00',
'2020-01-05 08:00:00', '2020-01-05 09:00:00',
'2020-01-05 10:00:00', '2020-01-05 11:00:00',
'2020-01-05 12:00:00', '2020-01-05 13:00:00',
'2020-01-05 14:00:00', '2020-01-05 15:00:00',
'2020-01-11 00:00:00', '2020-01-11 01:00:00',
'2020-01-11 02:00:00', '2020-01-11 03:00:00',
'2020-01-11 04:00:00', '2020-01-11 05:00:00',
'2020-01-11 06:00:00', '2020-01-11 07:00:00',
'2020-01-11 08:00:00', '2020-01-11 09:00:00',
'2020-01-11 10:00:00', '2020-01-11 11:00:00',
'2020-01-11 12:00:00', '2020-01-11 13:00:00',
'2020-01-11 14:00:00', '2020-01-11 15:00:00',
'2020-01-12 00:00:00', '2020-01-12 01:00:00',
'2020-01-12 02:00:00', '2020-01-12 03:00:00',
'2020-01-12 04:00:00', '2020-01-12 05:00:00',
'2020-01-12 06:00:00', '2020-01-12 07:00:00',
'2020-01-12 08:00:00', '2020-01-12 09:00:00',
'2020-01-12 10:00:00', '2020-01-12 11:00:00',
'2020-01-12 12:00:00', '2020-01-12 13:00:00',
'2020-01-12 14:00:00', '2020-01-12 15:00:00'],
dtype='datetime64[ns]', freq='CBH')
Expected Behavior
import pandas as pd
import datetime as dt
freq = pd.offsets.CustomBusinessHour(weekmask="Sat Sun", start="00:00", end="16:00")
pd.date_range(dt.datetime(2020,1,1), dt.datetime(2020,1,15), freq=freq)
Expected:
DatetimeIndex(['2020-01-04 00:00:00', '2020-01-04 01:00:00',
'2020-01-04 02:00:00', '2020-01-04 03:00:00',
'2020-01-04 04:00:00', '2020-01-04 05:00:00',
'2020-01-04 06:00:00', '2020-01-04 07:00:00',
'2020-01-04 08:00:00', '2020-01-04 09:00:00',
'2020-01-04 10:00:00', '2020-01-04 11:00:00',
'2020-01-04 12:00:00', '2020-01-04 13:00:00',
'2020-01-04 14:00:00', '2020-01-04 15:00:00',
'2020-01-04 16:00:00', '2020-01-05 00:00:00',
'2020-01-05 01:00:00', '2020-01-05 02:00:00',
'2020-01-05 03:00:00', '2020-01-05 04:00:00',
'2020-01-05 05:00:00', '2020-01-05 06:00:00',
'2020-01-05 07:00:00', '2020-01-05 08:00:00',
'2020-01-05 09:00:00', '2020-01-05 10:00:00',
'2020-01-05 11:00:00', '2020-01-05 12:00:00',
'2020-01-05 13:00:00', '2020-01-05 14:00:00',
'2020-01-05 15:00:00', '2020-01-05 16:00:00',
'2020-01-11 00:00:00', '2020-01-11 01:00:00',
'2020-01-11 02:00:00', '2020-01-11 03:00:00',
'2020-01-11 04:00:00', '2020-01-11 05:00:00',
'2020-01-11 06:00:00', '2020-01-11 07:00:00',
'2020-01-11 08:00:00', '2020-01-11 09:00:00',
'2020-01-11 10:00:00', '2020-01-11 11:00:00',
'2020-01-11 12:00:00', '2020-01-11 13:00:00',
'2020-01-11 14:00:00', '2020-01-11 15:00:00',
'2020-01-11 16:00:00', '2020-01-12 00:00:00',
'2020-01-12 01:00:00', '2020-01-12 02:00:00',
'2020-01-12 03:00:00', '2020-01-12 04:00:00',
'2020-01-12 05:00:00', '2020-01-12 06:00:00',
'2020-01-12 07:00:00', '2020-01-12 08:00:00',
'2020-01-12 09:00:00', '2020-01-12 10:00:00',
'2020-01-12 11:00:00', '2020-01-12 12:00:00',
'2020-01-12 13:00:00', '2020-01-12 14:00:00',
'2020-01-12 15:00:00', '2020-01-12 16:00:00'],
dtype='datetime64[ns]', freq='CBH')
Installed Versions
INSTALLED VERSIONS
commit : 91111fd
python : 3.9.2.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.19041
machine : AMD64
processor : Intel64 Family 6 Model 165 Stepping 5, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.5.1
numpy : 1.23.4
pytz : 2022.2.1
dateutil : 2.8.2
setuptools : 65.3.0
pip : 22.2.2
Cython : None
pytest : 7.2.0
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.3
lxml.etree : 4.9.1
html5lib : None
pymysql : None
psycopg2 : None
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader: None
bs4 : 4.11.1
bottleneck : None
brotli :
fastparquet : None
fsspec : 2022.8.2
gcsfs : None
matplotlib : 3.6.1
numba : None
numexpr : None
odfpy : None
openpyxl : 3.0.10
pandas_gbq : None
pyarrow : None
pyreadstat : None
pyxlsb : 1.0.10
s3fs : None
scipy : 1.8.1
snappy : None
sqlalchemy : 1.4.40
tables : None
tabulate : None
xarray : None
xlrd : None
xlwt : None
zstandard : None
tzdata : 2022.2