Given two DateTime arrays of equal size, my solution to find the mean between each DateTime pair in Julia is as follows:
using Dates
d1 = [DateTime(2000,1,1,14), DateTime(2000,1,1,15), DateTime(2000,1,2,14) + Millisecond(1)]
d2 = [DateTime(2000,1,1,13), DateTime(2000,1,1,12), DateTime(2000,1,2,10),]
d1 .+ map(v -> Millisecond(round(v.value * 0.5)), d2 .- d1)
Is this actually the best way to do it? - I find it quite convoluted ...
H.M.
P.S. For the underlying issue, see this item at JuliaLang
d1 .+ ((d2 .- d1) .÷2)
Where the items in d2 are after the ones in d1.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With