pandas has DataOffset type of objects like BDay
to represent business days, and if I add up a datetime , e.g. date(2009,1,1)+BDay(9)
, I get Timestamp('2009-01-14 00:00:00)
. How can I do the other side of the calculation, say like GetBusinessDaysInBetween(date(2009,1,1),date(2009,1,14)
and get business days?
Asked
Active
Viewed 153 times
0

NathaneilCapital
- 1,389
- 5
- 17
- 23
-
possible duplicate of [Get business days between start and end date using pandas](http://stackoverflow.com/questions/13019719/get-business-days-between-start-and-end-date-using-pandas) – Tim Zimmermann Aug 14 '14 at 22:45
-
I checked the post you mentioned, I actually want a direct calculation and re_index pandas using relative days, not re-align data frequency. The answer to the question didn't archive that. – NathaneilCapital Aug 14 '14 at 22:49
1 Answers
0
How about just generating the range and taking the length? If you need another offset, you can obviously just use date_range
and specific the offset.
len(pd.bdate_range(date(2009,1,1), date(2009,1,14)))

chrisb
- 49,833
- 8
- 70
- 70