-
-
Notifications
You must be signed in to change notification settings - Fork 68
Closed
Description
Quick question regarding converting a solution to DataFrame. If we want to obtain dataframe as the followin, it works
f_2dlinear = (du,u,p,t) -> du.=1.01u;
prob = ODEProblem(f_2dlinear,rand(2,2),(0.0,1.0));
sol1 =solve(prob,Euler();dt=1//2^(4));
df = DataFrame(sol1)
However, if I want to specify a solution e.g.
time_ = [0.0, 0.1, 0.2]
DataFrame(sol1(time_))
I get this error
ERROR: ArgumentError: 'DiffEqArray{Float64, 3, Vector{Matrix{Float64}}, Vector{Float64}, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), SciMLBase.NullParameters}' iterates 'Matrix{Float64}' values, which doesn't satisfy the Tables.jl `AbstractRow` interface
Stacktrace:
[1] invalidtable(#unused#::DiffEqArray{Float64, 3, Vector{Matrix{Float64}}, Vector{Float64}, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), SciMLBase.NullParameters}, #unused#::Matrix{Float64})
@ Tables ~/.julia/packages/Tables/PxO1m/src/tofromdatavalues.jl:42
[2] iterate
@ ~/.julia/packages/Tables/PxO1m/src/tofromdatavalues.jl:48 [inlined]
[3] buildcolumns
@ ~/.julia/packages/Tables/PxO1m/src/fallbacks.jl:197 [inlined]
[4] columns
@ ~/.julia/packages/Tables/PxO1m/src/fallbacks.jl:260 [inlined]
[5] DataFrame(x::DiffEqArray{Float64, 3, Vector{Matrix{Float64}}, Vector{Float64}, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), SciMLBase.NullParameters}; copycols::Nothing)
@ DataFrames ~/.julia/packages/DataFrames/zqFGs/src/other/tables.jl:58
[6] DataFrame(x::DiffEqArray{Float64, 3, Vector{Matrix{Float64}}, Vector{Float64}, Nothing, Nothing, typeof(SciMLBase.DEFAULT_OBSERVED), SciMLBase.NullParameters})
@ DataFrames ~/.julia/packages/DataFrames/zqFGs/src/other/tables.jl:49
[7] top-level scope
@ REPL[140]:1
Metadata
Metadata
Assignees
Labels
No labels