Skip to content

Weekmask & holidays error in CustomBusinessHour #23542

Closed
@mnpica

Description

@mnpica

Code Sample, a copy-pastable example if possible

from pandas.tseries.offsets import CustomBusinessDay, CustomBusinessHour
import pandas as pd
import datetime

weekmask = 'Mon Tue Wed Thu Fri Sat'
holidays=['2018-11-09']
bday = CustomBusinessDay(weekmask=weekmask,holidays=holidays)
dt=datetime.datetime(2018,11,8)
print dt+1*bday
# Holidays keyword is supported. 
# Output: Timestamp('2018-11-10 00:00:00')

bh = CustomBusinessHour(start='08:00', end='17:00', weekmask=weekmask,holidays=holidays)
print pd.Timestamp('2018-11-08 08:00')+10*bh
# Expected output: 2018-11-10 09:00:00 ,holidays keyword is not supported.
# Output:Timestamp('2018-11-09 09:00:00')

print pd.Timestamp('2018-11-08 08:00')+18*bh
# Seems right?
# Timestamp('2018-11-12 08:00:00')

bh = CustomBusinessHour(start='08:00', end='17:00', weekmask='Tue Wed Thu Fri Sat',holidays=holidays)
print pd.Timestamp('2018-11-08 08:00')+18*bh
# Expected output: 2018-11-13 08:00:00, weekmask keyword is not supported.
# Timestamp('2018-11-12 08:00:00')

Problem description

  1. Could Saturday be set as weekday?
  2. Could I use weekmask / holidays by CustomBusinessHour?

Expected Output

Output of pd.show_versions()

INSTALLED VERSIONS ------------------ commit: None python: 2.7.15.final.0 python-bits: 64 OS: Windows OS-release: 10 machine: AMD64 processor: Intel64 Family 6 Model 142 Stepping 9, GenuineIntel byteorder: little LC_ALL: None LANG: None LOCALE: None.None

pandas: 0.21.0
pytest: None
pip: 10.0.1
setuptools: 39.0.1
Cython: 0.27.3
numpy: 1.15.0
scipy: 1.0.0
pyarrow: None
xarray: None
IPython: 5.5.0
sphinx: None
patsy: None
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: 2.2.2
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: 1.0.2
lxml: None
bs4: None
html5lib: 1.0b10
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions