Home > front end >  bumping to good business day when generating range
bumping to good business day when generating range

Time:11-22

I am using pandas pd.bdate_range() to generate a range of dates given a start and end, but it seems to not work as expected.

What I am ultimately after is quarterly dates over a start and end date, but I want the dates to be valid business days.

start = '2015-06-01'
end = '2019-06-01'

dates = pd.bdate_range(start,end,freq='MS')[::3]

unfortunately this includes 2018-09-01 which is a Saturday

is there a more foolproof way to get an index of only business days?

CodePudding user response:

I think you can pass the following to get what you desire.

freq='BMS' # Business month start

or

freq='BQS' # Business quarter start

  • Related