Skip to content

Sinking to TimeArray sensitive to Array element type #53

@Keno

Description

@Keno

In code like:

ts3 = @from i in df3 begin
    @select {i.timestamp, i.NMerged}
    @collect TimeArray
end

I get

MethodError: no method matching TimeSeries.TimeArray(::Array{Any,1}, ::Array{Int64,2}, ::Array{String,1})
Closest candidates are:
  TimeSeries.TimeArray(::AbstractArray{D<:Base.Dates.TimeType,1}, ::AbstractArray{T,N}, ::Array{S<:AbstractString,1}, ::Any) where {T, N, D<:Base.Dates.TimeType, S<:AbstractString} at /home/juser/.julia/v0.6/TimeSeries/src/timearray.jl:41
  TimeSeries.TimeArray(::D<:Base.Dates.TimeType, ::AbstractArray{T,N}, ::Array{S<:AbstractString,1}, ::Any) where {T, N, D<:Base.Dates.TimeType, S<:AbstractString} at /home/juser/.julia/v0.6/TimeSeries/src/timearray.jl:44
  TimeSeries.TimeArray(::AbstractArray{D<:Base.Dates.TimeType,1}, ::AbstractArray, ::Any) where D<:Base.Dates.TimeType at /home/juser/.julia/v0.6/TimeSeries/src/timearray.jl:55
  ...

this is because timestamp has Any type, even though all the elements are DateTime. Inserting a df3[:timestamp] = map(identity, df3[:timestamp]) fixes the element type of the column and the error goes away, but I'd like IterableTables to do so by itself (and give a nice error if the timestamp is not of time type).

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions