TimeArray and last don't play well together

Hi all

I am puzzled as to why TimeArray does not fully work with last()

using Dates, TimeSeries
dates = Date(2018, 1, 1):Day(1):Date(2018, 12, 31)
ta = TimeArray(dates, rand(length(dates)))

then last(ta) works but last(ta,10) fails

all the best, Jack

Hi @JackStrauss !

Just some clarification questions:

Could you pass the error you get and also what you are expecting it should do @JackStrauss ?
Thanks!

~ tcp :deciduous_tree:

julia> last(ta, 1)
ERROR: MethodError: no method matching iterate(::Base.Iterators.Reverse{TimeArray{Float64, 1, Date, Vector{Float64}}})

I would file an issue on TimeSeries.jl

jzr
So you recon its a bug. I’ll file it with TimeSeries then.

try

ta[end-9:end]
#or 
tail(ta,10)

if you need first n

head(ta,n)

Thanks rocco_sprmnt21

Indeed, thats what I ended up doing, its just that I was puzzled by the failure of last(ta,1) and wondering if it was some Julia idiosyncrasy that I had missed.