I'm trying to add business days to a long list of data that's currently formatted as datetime64
objects, but with type 'ns'
.
As per the Numpy documentation, the busday_offset
function only works on objects with units of 'D'
. The functionality I want exists in Pandas, using 'BusiniessDayin
tseries.offsets`.
I could convert every date into a Pandas Timestamp
, then add the offset, and then convert back, but that feels like more work than it should be.
Is there a way to directly add an arbitrary number of business days to a datetime64
object that has 'ns'
units?
It's much easier to use pandas but here is a numpy implementation. I initially create dates from pandas but that is not necessary. Any numpy dates with ns precision should work.