Skip to content

BUG: bdate_range with cbh fails #62849

@jbrockmendel

Description

@jbrockmendel

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

# Based on https://github.com/pandas-dev/pandas/issues/24555#issuecomment-450909512

START = pd.Timestamp(2009, 3, 13)
END1 = pd.Timestamp(2009, 3, 18)
END2 = pd.Timestamp(2009, 3, 19)

freq = 'CBH'
a = pd.bdate_range(START, END1, freq=freq, weekmask='Mon Wed Fri',
                   holidays=['2009-03-14'])  # <- raises

freq = 'cbh'
a = pd.bdate_range(START, END1, freq=freq, weekmask='Mon Wed Fri',
                   holidays=['2009-03-14'])  # <- still raises

Issue Description

IIUC we deprecated the upper-cast "h" and so now instead of "CBH" we want "cbh". But inside bdate_range we have a check for isinstance(freq, str) and freq.startswith("C"). I suspect that needs to be updated to check for lowercase "c"? cc @natmokval ?

Expected Behavior

N/A

Installed Versions

Replace this line with the output of pd.show_versions()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions