JuliaStats / TimeSeries.jl

Time series toolkit for Julia
Other
352 stars 69 forks source link

Mapping time series does not work #459

Open juliohm opened 4 years ago

juliohm commented 4 years ago

MWE:

using TimeSeries

ts = Date(2000):Day(1):Date(2001)
vs = zeros(size(ts))

ta = TimeArray(ts, vs)

map(ta) do (t, v)
  # does not work
end

ERROR: MethodError: no method matching (::var"#13#14")(::Date, ::Float64)
Closest candidates are:
  #13(::Any) at REPL[18]:3
Stacktrace:
 [1] macro expansion at /home/juliohm/.julia/packages/TimeSeries/49cHd/src/combine.jl:184 [inlined]
 [2] map(::var"#13#14", ::TimeArray{Float64,1,Date,Array{Float64,1}}) at /home/juliohm/.julia/packages/TimeSeries/49cHd/src/combine.jl:174
simeonschaub commented 4 years ago

Is this type piracy by overloading Base.map really a good idea?

juliohm commented 4 years ago

Is there anyone maintaining TimeSeries.jl?

iblislin commented 4 years ago

Hi @juliohm

please try this

map(ta) do t, v
  t, v         
end
juliohm commented 4 years ago

It shows the same error.

On Mon, Jun 22, 2020, 02:26 Iblis Lin notifications@github.com wrote:

Hi @juliohm https://github.com/juliohm

please try this

map(ta) do t, v t, v end

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaStats/TimeSeries.jl/issues/459#issuecomment-647286761, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3OYL5DKSH2G73MOCY3RX3TP3ANCNFSM4N2Y662Q .

iblislin commented 4 years ago

@juliohm which version of Julia do you have?

I tested them on Julia v1.4 and Julia v1.3. You can consult the case cases of map as well: https://github.com/JuliaStats/TimeSeries.jl/blob/ed0cd207d379fe7959a00e5772034fcaec4b5eb5/test/combine.jl#L246

juliohm commented 4 years ago

We tested it on Julia v1.4. I can try reproduce the issue some other time when I am back to that environment.

On Mon, Jun 22, 2020, 08:22 Iblis Lin notifications@github.com wrote:

@juliohm https://github.com/juliohm which version of Julia do you have?

This tested them on Julia v1.4 and Julia v1.3. You can consult the case cases of map as well: https://github.com/JuliaStats/TimeSeries.jl/blob/ed0cd207d379fe7959a00e5772034fcaec4b5eb5/test/combine.jl#L246

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/JuliaStats/TimeSeries.jl/issues/459#issuecomment-647455028, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAZQW3M6TW3CIWP6LSCVYO3RX45HVANCNFSM4N2Y662Q .